Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 5 of 5 total |
How work with TReader? |
Fri, Apr 22 2016 5:02 AM | Permanent Link |
Ashirov | Hi!
I have some JSON data from server, how parse their and use in my application? { "data":[ { "id":42, "user_id":265, "msg_text":"Hi", "user_phone"one number, "user_name":"Make", "user_cityname":"Astana" }, { "id":43, "user_id":266, "msg_text":"Hi", "user_phone"one number, "user_name":"Bake", "user_cityname":"Astana" } } please give example how to use TParser, where set ARRAY_NAME for work with him. Example i use ARRAY_NAME - "data" thnx! |
Fri, Apr 22 2016 8:17 AM | Permanent Link |
Mark Brooks Slikware | >>Ashirov wrote:
>> >>Hi! >> >>I have some JSON data from server, how parse their and use in my application? There is some good coverage here: http://www.elevatesoft.com/forums?action=view&category=ewb&id=ewb_general&msg=5813&start=1&keywords=Treader%20array&searchbody=True&forum=EWB_Announce&forum=EWB_General&forum=EWB_Components&forum=EWB_Server&forum=EWB_Demos&forum=EWB_Binaries&forum=EWB_Discussion&forum=EWB2_Preview#5813 which has worked well for me. Regards Mark |
Fri, Apr 22 2016 8:39 AM | Permanent Link |
Matthew Jones | Mark Brooks wrote:
> which has worked well for me. Me too. I posted some questions about this recently, but if you search using the web interface for TReader etc then you will find all that is needed. -- Matthew Jones |
Mon, Apr 25 2016 11:37 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Ashirov,
<< I have some JSON data from server, how parse their and use in my application? >> Please post the class definition that you're trying to read this data into. The Object Persistence example application covers the basics on how to do deal with reading/writing to/from JSON, but it doesn't cover array handling. Tim Young Elevate Software www.elevatesoft.com |
Thu, Apr 28 2016 3:48 PM | Permanent Link |
Ashirov | Tim Young [Elevate Software] wrote:
Please post the class definition that you're trying to read this data into. The Object Persistence example application covers the basics on how to do deal with reading/writing to/from JSON, but it doesn't cover array handling. ---------------------------------------------------------------- it works but for one object, how parse array with many objects, and have array name {"id":"67","user_id":"591","msg_text":"some text","user_phone":"754546464","user_name":"Name","user_fname":"SecName ","candriver":"0","user_cityname":"City","ava":"def","city_id":"221","time_msg":"15:45:34","date_msg":"2016-04-28"} type TPushObj = class(TPersistent) private fid, fuser_id, fmsg_text, fuser_phone, fuser_name, fuser_fname, fcandriver, fuser_cityname, fava, fcity_id, ftime_msg, fdate_msg: string; public procedure LoadFromJSON(const aJSON: string); published property id: string read fid write fid; property user_id: string read fuser_id write fuser_id; property msg_text: string read fmsg_text write fmsg_text; property user_phone: string read fuser_phone write fuser_phone; property user_name: string read fuser_name write fuser_name; property user_cityname: string read fuser_cityname write fuser_cityname; property candriver: string read fcandriver write fcandriver; property ava: string read fava write fava; property city_id: string read fcity_id write fcity_id; property time_msg: string read ftime_msg write ftime_msg; property date_msg: string read fdate_msg write fdate_msg; end; procedure TPushObj.LoadFromJSON(const aJSON: string); var R: TReader; begin R := TReader.Create; R.Initialize(aJSON); try Self.LoadArray(R); finally R.Free; end; end; |
This web page was last updated on Friday, September 13, 2024 at 03:42 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |