Skip to content

JavaScript read JSON Array | Example code

  • by

You can read JSON arrays the same way read normal objects in JavaScript via dot notation. This will work on only JSON Objects.

var json = {"STOCKQTY":20,"PHYSICALQTY":10};


If you Have saved this json under another object You need to go deeper, eg.

var response = {AlreadySaved: [{"STOCKQTY":20,"PHYSICALQTY":10}] };


have json (eg from the response) as string not object.

console.log(typeof(someJson)); //string

In that case, You need to parse this string into json using the JSON parse method.

var json = JSON.parse(someJsonAsString);


Example read JSON Array in JavaScript

Simple example code. You can parse this and then get the value. Of course, if you receive this like a string.

<!DOCTYPE html>

    var json = [{
      "SNO": 1,
      "SNUMBER": "827",
      "STARTDATE": "11/12/2016",
      "STARTTIME": "03:06:50 PM",
      "ITEMNAME": "KBand",
      "ITEMCODE": "KB2541",
      "ITEMSKUNAME": "Band",
      "ITEMSKUCODE": "BT102",
      "SALESRATE": 100.0,
      "PURCHASERATE": 5.0,
      "DOE": "~",
      "STOCKQTY": 2.0,
      "PHYSICALQTY": 1.0





JavaScript read JSON Array

Do comment if you have any doubts or suggestions on the JS JSON Array topic.

Note: The All JS Examples codes are tested on the Firefox browser and the Chrome browser.

OS: Windows 10

Code: HTML 5 Version

Leave a Reply

Your email address will not be published. Required fields are marked *