Get multiple charts from json file

Hi, I have a json file, which I want to process to multiple charts.my file looks like this:

({"teplota":10.5678,"vlhkost":65.891,"oblacnost":0,"vietor":0,"tlak":1028.18,"smer":"JZ","pocitovo":9.24,"pocasie":"01d","vychod":"06:37","zapad":"17:15","cas":"Pondelok 22.2. 15:44","zrazky24":0});

my vision is to select value "teplota" and render it as a chart, next chart for "vlhkost",etc. thanks for your help.

Everything explain here

A keyword for your search is “multiple line on single chart”, so you could read more to know about chart data structure. It has been discussed many before

Do you multiple multiple charts, each with one line, or one chart with multiple lines.
See these docs (linked from the chart help text) for how to format data for pre-filling a chart.

That file is rendered from website. I just want to extract some values to the graph.

I am not sure I fully understand. Do you really mean a chart, which is an area with scales and lines drawn on it? You have only shown one set of values so I don't see how that can be used to draw lines.

[Edit] Also are the parentheses and semicolon really in the string? If so then strip those off and feed it through a JSON node which should convert the JSON string to a javascript object.

I can't edit an original file, because is on website. here is my flow:

[{"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":"25dd6728.b352c8","type":"debug","z":"1a2d781c.46fa4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":880,"y":120,"wires":[]},{"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":[["da84b8a7.59e13"]]},{"id":"71a1ee05.00e1f","type":"json","z":"1a2d781c.46fa4","name":"","property":"payload","action":"str","pretty":true,"x":340,"y":120,"wires":[["429836e1.7d4568"]]},{"id":"429836e1.7d4568","type":"file","z":"1a2d781c.46fa4","name":"chart","filename":"homie/homey-5ac5f38e42b2c4296e150d77/tester","appendNewline":false,"createDir":true,"overwriteFile":"true","x":460,"y":130,"wires":[["af7ad592.ac9f18"]]},{"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":590,"y":70,"wires":[["a5e9bc66.d78a7"]]},{"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":"af7ad592.ac9f18","type":"debug","z":"1a2d781c.46fa4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":470,"y":180,"wires":[]},{"id":"ed17743.b16b308","type":"ui_chart","z":"1a2d781c.46fa4","name":"","group":"8ac23c9c.86f8a8","order":13,"width":0,"height":0,"label":"chart","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":880,"y":50,"wires":[[]]},{"id":"44e5ee4.4aba71","type":"change","z":"1a2d781c.46fa4","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"meteostanica","tot":"str"},{"t":"set","p":"label","pt":"msg","to":"sasova","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":380,"y":80,"wires":[["71a1ee05.00e1f"]]},{"id":"a5e9bc66.d78a7","type":"change","z":"1a2d781c.46fa4","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"meteostanica","tot":"str"},{"t":"set","p":"label","pt":"msg","to":"sasova","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":740,"y":80,"wires":[["ed17743.b16b308","25dd6728.b352c8"]]},{"id":"da84b8a7.59e13","type":"split","z":"1a2d781c.46fa4","name":"","splt":"\\n","spltType":"str","arraySplt":"1","arraySpltType":"len","stream":false,"addname":"payload","x":350,"y":30,"wires":[["44e5ee4.4aba71"]]},{"id":"8ac23c9c.86f8a8","type":"ui_group","z":"","name":"Outside weather","tab":"98a2ef12.9e1df","order":1,"disp":false,"width":21,"collapse":false},{"id":"98a2ef12.9e1df","type":"ui_tab","z":"","name":"Weather","icon":"fa-sun-o","order":5,"disabled":false,"hidden":false}]

But you can manipulate the data once you hav retreived it....

First off, I suggest you run the original request and save the output to a file. That way you can use that file as input to test your flow without hammering the website.

Then I would change the split note to this:
Screen Shot 2021-02-23 at 3.54.09 AM

and add a switch node to only pass on lines containing ({
Screen Shot 2021-02-23 at 3.55.48 AM

Now you can use a change node to get rid of what ever you need before feeding it into a json node.

can you send me a edited flow?I am not sure where I need to place nodes :frowning:

Here is a screen print of the flow to help you build it:
Screen Shot 2021-02-23 at 4.49.32 AM

Note I had captured the html request and stuck it in a file for testing

what is a "get rid of ( and )? I am not sure what I need to set in "change" node.please export your flow.

The string you are getting that you display in your first post has opening and closing parentheses. You need to get rid of them so you can convert the line into a json object. Use a change node to search for a ( and replace it with nothing and do the same for the )

While I could give you the flow, one learns best by doing :slightly_smiling_face:

that is what I tried it. but it gives me a lot of debug messages and it looks like it doesn't work for me :frowning:

[{"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"]]}]

All you have provided is the change node. With no reference to where you put it in your flow or copies of the debug messages, how do you expect someone help you? What kind of debug msgs are you seeing? are they coming from this node? Where did you put the change node?

I have added debug to last node "json file". I see a lot of messages. :frowning:

Have ou got your json node set to 'Convert between JSON String & Object'? If not, set it to that.

Also give a name to the debug nodes so people can see- in the debug sidebar - which node they come from

.. and there is still a question mark ; at the end of the msg.payload string that needs to be filtered out with an additional Change rule ... in order to make it valid JSON

set to "convert between json" it makes me error :frowning:

That means the data you are sending nto the json node is not a json string. That means you haven't filtered out oll the data you do not want to pass thru. Not knowing what your 'cchat' file looks like, I can't tell you what to do, but if you put a debug on the on the ootput of the split node it should tell you what esle to filter out.

I have this in "split" nodes


If you look at the last debug, what do you see as the first character in msg.payload and what should it be?