# Get multiple charts from json file

**URL:** <https://discourse.nodered.org/t/get-multiple-charts-from-json-file/41435>\
**Category:** Dashboard\
**Created:** [22 February 2021 14:55 UTC](https://discourse.nodered.org/t/get-multiple-charts-from-json-file/41435 "2021-02-22T14:55:57Z")\
**Posts on this page:** 15\
**Page:** 2

<div class="post-metadata">

**Author:** ![kapusticka](https://avatars.discourse-cdn.com/v4/letter/k/b4bc9f/32.png) [@kapusticka](https://discourse.nodered.org/u/kapusticka)\
**Post date:** [23 February 2021 16:20 UTC](https://discourse.nodered.org/t/get-multiple-charts-from-json-file/41435/21 "2021-02-23T16:20:18Z")

</div>

first character is "

 ![Snímka obrazovky 2021-02-23 o 17.19.19](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/2/12893882537818a780b131d2166cfb0993850d26.png)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [23 February 2021 16:22 UTC](https://discourse.nodered.org/t/get-multiple-charts-from-json-file/41435/22 "2021-02-23T16:22:51Z")

</div>

The point is it isn't valid JSON and that's why you getting an error

A simple test - click the copy button that appears under your mouse cursor when you hover over the payload in the debug sidebar. Then go to any of the hundreds of online JSON validator websites and paste it in. You will see it is not valid JSON.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [23 February 2021 16:29 UTC](https://discourse.nodered.org/t/get-multiple-charts-from-json-file/41435/23 "2021-02-23T16:29:54Z")

</div>

@kapusticka

 ![Screen Shot 2021-02-23 at 11.29.10 AM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/8/586680a3274e0f554cdcaa744689496373bdf490.png)

---

<div class="post-metadata">

**Author:** ![kapusticka](https://avatars.discourse-cdn.com/v4/letter/k/b4bc9f/32.png) [@kapusticka](https://discourse.nodered.org/u/kapusticka)\
**Post date:** [23 February 2021 16:41 UTC](https://discourse.nodered.org/t/get-multiple-charts-from-json-file/41435/24 "2021-02-23T16:41:53Z")

</div>

this have ho results 😕

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [23 February 2021 16:49 UTC](https://discourse.nodered.org/t/get-multiple-charts-from-json-file/41435/25 "2021-02-23T16:49:08Z")

</div>

Please open the 'chart' file you have and copy and past the results into a reply so I can see the data you are using.

---

<div class="post-metadata">

**Author:** ![kapusticka](https://avatars.discourse-cdn.com/v4/letter/k/b4bc9f/32.png) [@kapusticka](https://discourse.nodered.org/u/kapusticka)\
**Post date:** [23 February 2021 16:54 UTC](https://discourse.nodered.org/t/get-multiple-charts-from-json-file/41435/26 "2021-02-23T16:54:59Z")

</div>

this is the result of my file, stored in file.

```auto
({"teplota":5.77586,"vlhkost":81.6777,"oblacnost":27.488888888888887,"vietor":0,"tlak":1036.17,"smer":"JZ","pocitovo":4.14,"pocasie":"01n","vychod":"06:36","zapad":"17:17","cas":"Utorok 23.2. 17:40","zrazky24":0});

```

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [23 February 2021 17:03 UTC](https://discourse.nodered.org/t/get-multiple-charts-from-json-file/41435/27 "2021-02-23T17:03:46Z")

</div>

Ahhh I see, In your original flow you were getting the data from the website and that is what I was working off of. So is this file what you want to parse or is it the data straight from the website?

Also please provide the flow as you have it now.

---

<div class="post-metadata">

**Author:** ![kapusticka](https://avatars.discourse-cdn.com/v4/letter/k/b4bc9f/32.png) [@kapusticka](https://discourse.nodered.org/u/kapusticka)\
**Post date:** [23 February 2021 17:25 UTC](https://discourse.nodered.org/t/get-multiple-charts-from-json-file/41435/28 "2021-02-23T17:25:18Z")

</div>

I just download file to my server, that I want to render to my weather station as a graphs.  
here is my flow:

```auto
[{"id":"1a2d781c.46fa4","type":"tab","label":"Weather","disabled":false,"info":""},{"id":"e275a8a5.6029b8","type":"inject","z":"1a2d781c.46fa4","name":"make request","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":"","x":100,"y":80,"wires":[["aaf7ab1c.57a3e"]]},{"id":"aaf7ab1c.57a3e","type":"http request","z":"1a2d781c.46fa4","name":"","method":"GET","ret":"txt","paytoqs":false,"url":"http://meteosasova.sk/bbo_api.php","tls":"","persist":false,"proxy":"","authType":"","x":190,"y":30,"wires":[["332cb90c.a041ee"]]},{"id":"429836e1.7d4568","type":"file","z":"1a2d781c.46fa4","name":"chart","filename":"homie/homey-5ac5f38e42b2c4296e150d77/tester","appendNewline":false,"createDir":true,"overwriteFile":"true","x":380,"y":90,"wires":[["af7ad592.ac9f18"]]},{"id":"af7ad592.ac9f18","type":"debug","z":"1a2d781c.46fa4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":390,"y":140,"wires":[]},{"id":"714e54e1.d9d134","type":"inject","z":"1a2d781c.46fa4","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":590,"y":20,"wires":[["2f80eb1c.584794"]]},{"id":"2f80eb1c.584794","type":"file in","z":"1a2d781c.46fa4","name":"chart","filename":"homie/homey-5ac5f38e42b2c4296e150d77/tester","format":"utf8","chunk":false,"sendError":false,"encoding":"none","x":720,"y":20,"wires":[["73162131.f881d8","aae9744e.444338"]]},{"id":"73162131.f881d8","type":"split","z":"1a2d781c.46fa4","name":"","splt":">","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":600,"y":90,"wires":[["60d006.10541ffc"]]},{"id":"60d006.10541ffc","type":"switch","z":"1a2d781c.46fa4","name":"","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"\"({","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":610,"y":140,"wires":[["b6c82e3e.6848d"],[]]},{"id":"b6c82e3e.6848d","type":"change","z":"1a2d781c.46fa4","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"\"({","fromt":"str","to":"","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"});\"","fromt":"str","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":660,"y":190,"wires":[["4f96e5c5.27967c"]]},{"id":"4f96e5c5.27967c","type":"split","z":"1a2d781c.46fa4","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":670,"y":250,"wires":[["3c4a1319.40fa1c","9e745726.41c888"]]},{"id":"3c4a1319.40fa1c","type":"json","z":"1a2d781c.46fa4","name":"","property":"payload","action":"str","pretty":false,"x":680,"y":300,"wires":[["cb3eaf48.2d056"]]},{"id":"cb3eaf48.2d056","type":"debug","z":"1a2d781c.46fa4","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":820,"y":300,"wires":[]},{"id":"332cb90c.a041ee","type":"split","z":"1a2d781c.46fa4","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":220,"y":160,"wires":[["429836e1.7d4568"]]},{"id":"aae9744e.444338","type":"debug","z":"1a2d781c.46fa4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":960,"y":70,"wires":[]},{"id":"9e745726.41c888","type":"debug","z":"1a2d781c.46fa4","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":820,"y":250,"wires":[]}]

```

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [23 February 2021 17:43 UTC](https://discourse.nodered.org/t/get-multiple-charts-from-json-file/41435/29 "2021-02-23T17:43:43Z")

</div>

Try this but make sure to point to the correct file;

```auto
[{"id":"f66e8a2c.747eb8","type":"inject","z":"2ed58e52.2bc8ba","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":380,"y":100,"wires":[["52a019c2.ba757"]]},{"id":"52a019c2.ba757","type":"file in","z":"2ed58e52.2bc8ba","name":"chart","filename":"/Users/Paul/tmp/tester.txt","format":"utf8","chunk":false,"sendError":false,"encoding":"none","x":370,"y":180,"wires":[["d974618a.71486","443afdf3.b6f3ec"]]},{"id":"443afdf3.b6f3ec","type":"change","z":"2ed58e52.2bc8ba","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"({","fromt":"str","to":"{","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"});","fromt":"str","to":"}","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":380,"y":260,"wires":[["5bb2178f.a40788","3a8741ce.13a156"]]},{"id":"3a8741ce.13a156","type":"json","z":"2ed58e52.2bc8ba","name":"","property":"payload","action":"obj","pretty":false,"x":370,"y":380,"wires":[["3ec7dd86.b125ca"]]},{"id":"3ec7dd86.b125ca","type":"debug","z":"2ed58e52.2bc8ba","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":630,"y":380,"wires":[]},{"id":"d974618a.71486","type":"debug","z":"2ed58e52.2bc8ba","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":640,"y":140,"wires":[]},{"id":"5bb2178f.a40788","type":"debug","z":"2ed58e52.2bc8ba","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":650,"y":260,"wires":[]}]

```

---

<div class="post-metadata">

**Author:** ![kapusticka](https://avatars.discourse-cdn.com/v4/letter/k/b4bc9f/32.png) [@kapusticka](https://discourse.nodered.org/u/kapusticka)\
**Post date:** [23 February 2021 18:17 UTC](https://discourse.nodered.org/t/get-multiple-charts-from-json-file/41435/30 "2021-02-23T18:17:25Z")

</div>

it works! thank you

 ![Snímka obrazovky 2021-02-23 o 19.12.54](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/b/bbe97ee1a3b66629e1fa59afc02736eac9fa3833.jpeg) ![Snímka obrazovky 2021-02-23 o 19.13.04](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/f/3f54aeffc611b948759ca352b997b3ad5d386c14.png)

---

<div class="post-metadata">

**Author:** ![kapusticka](https://avatars.discourse-cdn.com/v4/letter/k/b4bc9f/32.png) [@kapusticka](https://discourse.nodered.org/u/kapusticka)\
**Post date:** [23 February 2021 21:53 UTC](https://discourse.nodered.org/t/get-multiple-charts-from-json-file/41435/31 "2021-02-23T21:53:54Z")

</div>

I have a little issue. how can I display some payload to chart? for example msg.payload.teplota to line chart?

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [23 February 2021 23:05 UTC](https://discourse.nodered.org/t/get-multiple-charts-from-json-file/41435/32 "2021-02-23T23:05:17Z")

</div>

Use a change node set to move msg.payload.teplota to msg.payload then feed to the chart

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [24 February 2021 08:41 UTC](https://discourse.nodered.org/t/get-multiple-charts-from-json-file/41435/33 "2021-02-24T08:41:49Z")

</div>

In fact, due to the fact that you are sending the data to a gauge, not a chart, then you don't need to use a Change node. You can feed the payload directly into the gauge, and in the Value Format field use  
`{{msg.payload.teplota}}`  
In addition if you want it rounded to two decimal places, for example, use  
`{{msg.payload.teplota | number:2}}`

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [24 February 2021 09:49 UTC](https://discourse.nodered.org/t/get-multiple-charts-from-json-file/41435/34 "2021-02-24T09:49:19Z")

</div>

When it says

> [@kapusticka](#):
>
> to line chart

I assumed they meant also send to a chart ...

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [26 March 2021 09:49 UTC](https://discourse.nodered.org/t/get-multiple-charts-from-json-file/41435/35 "2021-03-26T09:49:57Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.

[Previous page](https://discourse.nodered.org/t/get-multiple-charts-from-json-file/41435.md?page=1)
