# Read data from JSON array

**URL:** <https://discourse.nodered.org/t/read-data-from-json-array/1938>\
**Category:** Dashboard\
**Created:** [31 July 2018 18:39 UTC](https://discourse.nodered.org/t/read-data-from-json-array/1938 "2018-07-31T18:39:06Z")\
**Posts on this page:** 3\
**Page:** 3

<div class="post-metadata">

**Author:** ![Ahd](https://avatars.discourse-cdn.com/v4/letter/a/e9a140/32.png) [@Ahd](https://discourse.nodered.org/u/Ahd)\
**Post date:** [5 August 2018 09:27 UTC](https://discourse.nodered.org/t/read-data-from-json-array/1938/41 "2018-08-05T09:27:35Z")

</div>

@ Andrei

Thanks, Sir, I did a quick testing which shows it works perfectly. Many thanks again!!.

---

<div class="post-metadata">

**Author:** ![sanjeev](https://avatars.discourse-cdn.com/v4/letter/s/35a633/32.png) [@sanjeev](https://discourse.nodered.org/u/sanjeev)\
**Post date:** [11 March 2019 10:28 UTC](https://discourse.nodered.org/t/read-data-from-json-array/1938/42 "2019-03-11T10:28:08Z")

</div>

this is the json formatted file how to print some specific value  
like only id value.  
[  
{  
"id": "77fe19a.cdb9ee8",  
"type": "debug",  
"z": "31ac8dfb.337542",  
"name": "",  
"active": true,  
"tosidebar": true,  
"console": true,  
"tostatus": false,  
"complete": "payload",  
"x": 646,  
"y": 204,  
"wires":   
},  
{  
"id": "4f531964.dad328",  
"type": "function",  
"z": "31ac8dfb.337542",  
"name": "print",  
"func": "\nvar x = msg.payload;\nvar y= x \* x;\nreturn { payload : y};\n",  
"outputs": 1,  
"noerr": 0,  
"x": 375,  
"y": 201,  
"wires": [  
[  
"77fe19a.cdb9ee8"  
]  
]  
},  
{  
"id": "4eaa8e0d.bdfb5",  
"type": "inject",  
"z": "31ac8dfb.337542",  
"name": "",  
"topic": "square",  
"payload": "5",  
"payloadType": "num",  
"repeat": "",  
"crontab": "",  
"once": false,  
"onceDelay": 0.1,  
"x": 101,  
"y": 204,  
"wires": [  
[  
"4f531964.dad328"  
]  
]  
}  
]

---

<div class="post-metadata">

**Author:** ![MYXATA](https://avatars.discourse-cdn.com/v4/letter/m/90ced4/32.png) [@MYXATA](https://discourse.nodered.org/u/MYXATA)\
**Post date:** [19 March 2019 10:36 UTC](https://discourse.nodered.org/t/read-data-from-json-array/1938/43 "2019-03-19T10:36:33Z")

</div>

Hi Guys,  
I have a similar problem parsing JSONarray , so maybe it is not worth to create new topic.  
So I have a data incoming from small MCU with json format  
{"filter1":[{"tap": 68},{"tap": -191},{"tap": 784},{"tap": 1482},{"tap": 736},{"tap": -161},{"tap": -1666},{"tap": -67},{"tap": 0},{"tap": 0},{"tap": 0},{"tap": 0}]}  
and I want to plot it in the bar chart.  
so every bar is filter tap.  
problem is that I can't(don't know how to deserialize this json object.

my setup is follows - I'm reading from uart(serial in node)-\>JSON node-\> function-\>chart

any suggestions and hints are welcome.  
P.S.  
I've tried 🙂  
var arr = msg.payload.filter1;  
var msgs={ payload:[0]} ;

for(i=1; i \< arr.length; i++){

```
msgs.payload.push(arr[i].tap);

```

}  
return [msgs];  
but I have error from node console:  
19 Mar 14:46:24 - [warn] [ui\_chart:66d0e46a.d1521c] Bad data inject  
19 Mar 14:46:24 - [info] [debug:df333238.11b18]  
[-100, 931, 2170, 122, -452, -1279, -198, 0, 0, 0, 0]

is this error in parser function or in chart node?

[Previous page](https://discourse.nodered.org/t/read-data-from-json-array/1938.md?page=2)
