thinghttp json parse string get more value.

I want to get 2-3 of the results at once using parse string in thingHTTP. Is it possible?
I can get 1 value using PArse string, but I want to get several values together. I want to get date and time together from the results in this example.
Results is :
{ "date": "03-18-2023", "milliseconds_since_epoch": 1679147976499, "time": "01:59:36 PM" }
How can I write parse string box in thinghttp?
Thanks

2 件のコメント

Sachin
Sachin 2023 年 3 月 20 日
Could you please explain what do you want ?
Safak Agustoslu
Safak Agustoslu 2023 年 3 月 23 日
In the THINGHTTP section, in the parse string box,
I can get 1 variable from JSON string. So I can get the "date" variable.
But I want to be able to get the "date" and "time" variables together. For example, I write "date,time" or "date/time" in the parse string box and it gives an error.
What I want to do is to get together as 03-18-2023 - 01:59:36 PM.
Or
Have I made a request in this type of string once. To get EpochDate, temperature, and rain status together.
Thanks
It's part of the JSON string. not all.
Example.
{"Headline":{"EffectiveDate":"2023-03-23T02:00:00-04:00","EffectiveEpochDate":1679551200,"Severity":3,"Text":"Expect rainy weather late Wednesday night through this afternoon","Category":"rain","EndDate":"2023-03-23T20:00:00-04:00","EndEpochDate":1679616000,"MobileLink":"http://www.accuweather .com/en/ca/toronto/m5h/daily-weather-forecast/55488?lang=en-us","Link":"http://www.accuweather.com/en/ca/toronto/m5h/daily -weather-forecast/55488?lang=en-us"},"DailyForecasts":[{"Date":"2023-03-22T07:00:00-04:00","EpochDate":1679482800,"Temperature" :{"Minimum":{"Value":40.0,"Unit":"F","UnitType":18},"Maximum":{"Value":42.0,"Unit":"F","UnitType" :18}},"Day":{"Icon":7,"IconPhrase":"Cloudy","HasPrecipitation":false},"Night":{"Icon":18,"IconPhrase":"Rain", "HasPrecipitation":true,"PrecipitationType":"Rain","PrecipitationIntensity":"Light"},"Sources":["AccuWeather"],"MobileLink":"http://www.accuweather.com/en/ ca/toronto/m5h/daily-weather-forecast/55488?lang=en-us","Link":"http://www.accuweather.com/en/ca /toronto/m5h/daily-weather-forecast/55488?lang=en-us"},{"Date":"2023-03-23T07:00:00-04:00","EpochDate":1679569200,"Temperature ":{"Minimum":{"Value":30.0,"Unit":"F","UnitType":18},"Maximum":{"Value":48.0,"Unit":"F","UnitType ":18}},"Day":

サインインしてコメントする。

 採用された回答

Sachin
Sachin 2023 年 3 月 23 日

0 投票

Hi
I understand that you want more values using parse string in thinghttp.
I assume that your URL response is JSON. Since you want to get multiple values at once So I suggest[AK1] you to use the ‘webread’ function in MATLAB. This function will help you to get all the JSON object values at once.
webread('your url')
This will return a struct with fields.
For more information about ‘webread’ refer to:

5 件のコメント

Safak Agustoslu
Safak Agustoslu 2023 年 3 月 23 日
I used it as WEBREAD. no problem there.
But how can I use it inside the PARSE STRING box?
How can I connect to ThingHTTP?
webread program is working.
httpsUrl = "http://time.jsontest.com/";
dataUrl = strcat(httpsUrl, "");
data = webread(dataUrl);
TIME = [data.time];
DATE = [data.date];
total=[data.date,data.time]
disp(total);
Sachin
Sachin 2023 年 3 月 23 日
You can parse one string at a time using thingHttp.
Safak Agustoslu
Safak Agustoslu 2023 年 3 月 23 日
Thanks a lot for your answers
I understand you.
please tell me How can I integrate the Webread widget into my own programs?
Or
How can I activate this program piece from the internet with an http request? Also, how can this piece of program respond to the http request I send from the internet?
Is there a way like Thinghttp?
I also used matlabvisual. for this code snippet. It worked flawlessly. But when I make an http request from the internet, it does not give any return information.
This is what returns in response.
03-23-202301:26:07 PM
This is the matlab visual program part.
% Enter your MATLAB code below
httpsUrl = "http://time.jsontest.com/";
dataUrl = strcat(httpsUrl, "");
data = webread(dataUrl);
TIME = [data.time];
DATE = [data.date];
total=[data.date,data.time];
disp(total);
Sachin
Sachin 2023 年 3 月 23 日
編集済み: Sachin 2023 年 3 月 23 日
Safak Agustoslu
Safak Agustoslu 2023 年 3 月 23 日
Thanks

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeAct on Data についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by