Giedrius Giedrius - 1 year ago 98
JSON Question

Formatting json properties

I have a JSON file with thousands of lines, which i need to have in another format.

My current code looks like that:


And it should look like this:


Is there a tool or a quick way to do this, changing thousands of lines manually would take too much time.

Thanks in advance.

Answer Source

Programmatically, say php for instance, and treating each line of your JSON file as a string, you could use preg_replace(), but since it's a one time requirement, simply load your json file into a text editor and:

Delete the leading and ending square braces.

Find all {"Date":" replace with [Date.UTC(

Find all ","Value": replace with ),

Find all }, replace with ],


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download