Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Create A JSON From 2D Array Example

	const url = new URL('https://example.com/?firstkey=firstvalue&secondkey=secondvalue');

console.log(url.href);
// https://example.com/?a=hello&b=world

console.log(url.origin);

var obj = {};
for(const [key, value] of Array.from(url.searchParams.entries()))
{
	obj[key] = value;

}
console.log(obj);
 /*Object { firstkey: "firstvalue", secondkey: "secondvalue" }*/
Source by gist.github.com #
 
PREVIOUS NEXT
Tagged: #Create #A #JSON #From #Array #Example
ADD COMMENT
Topic
Name
6+4 =