Hi,
Im getting data from html page and need to convert the array into Json to get it into cloud.
I am using the JSON node, but the result doesnt look like Json to me, also the data is not in the cloud.
Could anybody help me?
Looks like a JSON string to me, If you want a JS object then do not pass it through a JSON node.
This is not a valid JavaScript Object. You cannot have duplicate property names - each object can only have one hour and one price.
{
"hour": 00:00-01:00,
"price": 0.33,
"hour": 00:10-02:00,
"price": 0.39,
}
The Function code you have written is more correct; it creates an individual object for each hour/price pair.
But ultimately it depends on what you want to do with this data - and what format the cloud service you are using expects to receive.
you are right! i need to have the data in Json format to get them into the cloud.
So probably now I can somehow split these into multiple JSONs for each time/price and send them to the cloud separately or create one JSON with different key names like Hour1, Price 1, etc..
the first option makes more sense