S sivakrith Member Licensed User Longtime User Jan 30, 2021 #1 Hello, Created a JSON using DBUtils.ExecuteJSON by passing required parameters and then converted it into a string using toString method. Works fine. Verified that it's a valid JSON. Now I want to parse this JSON and extract individual values. This generated JSON starts with root and I couldn't find a way to parse this string. The (sample) string that I get looks like this: {"root":[{"field1":"M","field2":"1234567890","field3":1611920526063,"field4":"789","field5":"#Î@Í%Ì"}, "field1":"O","field2":"123","field3":1611930204138,"field4":"ed6bef4700dc7a4d1448a1ce862cef54","field5":"#Î@Í%Ì"}]} Any code snippet to parse this string is really appreciated. Happiness Always BKR Sivaprakash
Hello, Created a JSON using DBUtils.ExecuteJSON by passing required parameters and then converted it into a string using toString method. Works fine. Verified that it's a valid JSON. Now I want to parse this JSON and extract individual values. This generated JSON starts with root and I couldn't find a way to parse this string. The (sample) string that I get looks like this: {"root":[{"field1":"M","field2":"1234567890","field3":1611920526063,"field4":"789","field5":"#Î@Í%Ì"}, "field1":"O","field2":"123","field3":1611930204138,"field4":"ed6bef4700dc7a4d1448a1ce862cef54","field5":"#Î@Í%Ì"}]} Any code snippet to parse this string is really appreciated. Happiness Always BKR Sivaprakash
Gabino A. de la Gala Well-Known Member Licensed User Longtime User Jan 30, 2021 #2 I think the json must be : B4X: {"root":[{"field1":"M","field2":"1234567890","field3":1611920526063,"field4":"789","field5":"#Î@Í%Ì"}, {"field1":"O","field2":"123","field3":1611930204138,"field4":"ed6bef4700dc7a4d1448a1ce862cef54","field5":"#Î@Í%Ì"}]} Try it here : http://basic4ppc.com:51042/json/index.html Upvote 0
I think the json must be : B4X: {"root":[{"field1":"M","field2":"1234567890","field3":1611920526063,"field4":"789","field5":"#Î@Í%Ì"}, {"field1":"O","field2":"123","field3":1611930204138,"field4":"ed6bef4700dc7a4d1448a1ce862cef54","field5":"#Î@Í%Ì"}]} Try it here : http://basic4ppc.com:51042/json/index.html
S sivakrith Member Licensed User Longtime User Jan 30, 2021 #3 Super.. Thanks Gabino. http://basic4ppc.com:51042/json/index.html Who did this excellent work ? Kudos to him. Thanks. Upvote 0
Super.. Thanks Gabino. http://basic4ppc.com:51042/json/index.html Who did this excellent work ? Kudos to him. Thanks.
Gabino A. de la Gala Well-Known Member Licensed User Longtime User Jan 30, 2021 #4 sivakrith said: Super.. Thanks Gabino. http://basic4ppc.com:51042/json/index.html Who did this excellent work ? Kudos to him. Thanks. Click to expand... @Erel Erel www.b4x.com JsonTree - Tool to help with JSON parsing (B4A / B4J) JsonTree is a tool that helps developers to parse and understand JSON strings. It shows the data structure in a TreeView and it also prints the code (B4J / B4A) required in order to extract the data from the string. Note that variables in the generated code are based on the JSON fields. It may... www.b4x.com Upvote 0
sivakrith said: Super.. Thanks Gabino. http://basic4ppc.com:51042/json/index.html Who did this excellent work ? Kudos to him. Thanks. Click to expand... @Erel Erel www.b4x.com JsonTree - Tool to help with JSON parsing (B4A / B4J) JsonTree is a tool that helps developers to parse and understand JSON strings. It shows the data structure in a TreeView and it also prints the code (B4J / B4A) required in order to extract the data from the string. Note that variables in the generated code are based on the JSON fields. It may... www.b4x.com