Convert a Key Value Pairs list into a Javascript JSON Array

Convert a spreadsheet list of key values pairs into JavaScript JSON array.
Save time coding and avoid programming errors.
Copy in the text and click Get Results button. JSON array code can be copied out from the bottom textarea.
Use key value pairs like: MyArray[0].key + " " + MyArray[0].value;


Text Inputs

MyArray

key1 value1
key2 value2
key3 value3

Javascript JSON Array Example Code Output

var MyArray = [
{"key":"key1", "value":"value1"},
{"key":"key2", "value":"value2"},
{"key":"key3", "value":"value3"}
];




JavaScript Array Name


Enter your array name hear. Array Name should start with a alphabetical letter.

Your key value pairs list to copy in here

Use spreadsheet to open your key value pair list file and copy the contents into the top text area box.
Shortcuts include: Ctrl A for select all, Ctrl C for copy and Ctrl V for paste.

     Press Get Result button after completing copying in list in to text area above.


JavaScript JSON Array Format Results Appear Here



Ctrl A = Select All, Ctrl C = Copy, Ctrl V = Paste.
Copy the lower Javascript results into a Javascript code editor.

  • Convert a list of values into an array
  • Create a JSON object, which is the same as an array but more organized and easier to read
  • A javascript object in JSON is an associative array with a string key and value.
  • It therefore appears very similar to a JavaScript object literal.
  • The difference between the two is that the objects are stored as key-value pairs, while literals defines arbitrary keys.
  • Javascript objects are nested key-value arrays.