[SOLVED] Parsing data from a GET request


#1

1) Give a description of the problem
I am trying to figure out how to parse the multiple data points collected from a GET and parse it into separate variables. I’ve been working with expressions but have had no luck.

The date seen in the piston image is how it’s formatted but that format can be changed if necessary.

**4) Post a Green Snapshot of the piston![image|45x37]


#2

Is that info from twc or something custom?


#3

It is custom which is from my weather station. I use “Weather Display” software which connect to my station and collects the data. That same software also uploads to wunderground. It seem to me I should be able to get the same data, and so much more if I can get it directly without the need for twcweather.

That is why I can change the format of the data I’m collecting if it makes it easier.


#4

Can you get it to output it in json format? I think you’ll probably have better control of getting the values you want compared to text manipulation using webcore text functions.


#5

I think so. All that would be needed would be to change the comma separator to a colon?
I was trying that format but couldn’t figure that out. I have some code experience but not much.


#6

Comma to colon, space to comma


#7

Like this, correct?
52


#8

Yeah


#9

I was trying the json format before but wasn’t having and luck. Perhaps it was because I didn’t have the space after the colon? If so I’ll go back and try and make it work.


#10

Actually, remove the space after the colon (not sure if webcore will choke on that). Then in your piston try to get the value of HighTemp using $response.HighTemp


#11

Tried using it with and without a space and I get the same results.
If this would have worked it would be fantastic. Any other ideas?


#12

Can you add a comma separator for each key/value pair?


#13

Do you mean like this?

“HighTemp”,“86”
or
“HighTemp”:",86"
or like this;
“HighTemp”:“86”,


#14

“HighTemp”:“86”,“LowTemp”:“62”,
"HighTemp":"86","LowTemp":"62",

Oh, and also, the quotes, make sure they’re the plain double quotes, not the fancy ones that macs use. I’m not sure what it’s called :slight_smile:


#15

Tried it and still nothing. I’m using the plain double quotes. Can’t understand why it isn’t working. I even removed the carnage returns from the data so its just one long string as is shows in the variable.


#16

Paste that data in plain text so I can copy it and give it a try. Or just throw in an open and close curly bracket with your data. { data }


#17

{“TempOut”:“84”,“HumOut”:“70”,“DewPnt”:“73”,“WindSpeed”:“7”,“WindGust”:“6”,“WindDirection”:“WSW”,“DailyPrecip”:“0.16”,“HourlyPrecip”:“0.000”,“Solar”:“708”,“TimeOfDay”:“Afternoon”,“MaxDaylight”:“14:52”,“Conditions”:“Dry”,“Conditions_Detail”:“Its Afternoon,Dry and it feels Warm outside. The temperature has been rising for the last few hours. There is a Gentle Breeze from the West south west”,“AverageTempMoth”:“58.4”,“AverageTempDay”:“69.8”,“HighTemp”:“84”,“LowTemp”:“62”
}


#18

I noticed there are commas inside double quoted text. That shouldn’t have any effect correct?


#19

image

It’s the fancy quotes that’s throwing the error.


#20

I am not clear about the fancy quotes. I am running on windows and just using plain double quotes. I don’t think I have any other option.