Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #4531 > unrolled thread

JSON parser in VO, with sample/demo

Started bySherlock <sherlock@sherlock.com.au>
First post2012-12-29 00:37 -0800
Last post2016-06-24 05:02 -0700
Articles 14 — 9 participants

Back to article view | Back to comp.lang.clipper.visual-objects


Contents

  JSON parser in VO, with sample/demo Sherlock <sherlock@sherlock.com.au> - 2012-12-29 00:37 -0800
    Re: JSON parser in VO, with sample/demo Sherlock <sherlock@sherlock.com.au> - 2012-12-29 00:54 -0800
    Re: JSON parser in VO, with sample/demo "Rene J. Pajaron" <rjpajaron@gmail.com> - 2014-10-27 19:19 -0700
    Re: JSON parser in VO, with sample/demo "Marc Verkade [MITCon]" <marc@mitNOSPAMconDELETE.nl> - 2014-10-28 03:29 +0100
    Re: JSON parser in VO, with sample/demo bazman@arach.net.au - 2014-12-29 19:32 -0800
      Re: JSON parser in VO, with sample/demo "Philippe Bayard (Belgium)" <philbayard@gmail.com> - 2015-01-09 06:04 -0800
    Re: JSON parser in VO, with sample/demo sudden2011@gmail.com - 2016-06-12 18:16 -0700
      Re: JSON parser in VO, with sample/demo sherlocksoftware@gmail.com - 2016-06-13 02:23 -0700
        Re: JSON parser in VO, with sample/demo Sherlock <sherlock@sherlock.com.au> - 2016-06-23 23:37 -0700
        Re: JSON parser in VO, with sample/demo Ales Suchac <asuchac43@gmail.com> - 2016-06-24 00:03 -0700
    Re: JSON parser in VO, with sample/demo sherlocksoftware@gmail.com - 2016-06-24 05:29 -0700
    Re: JSON parser in VO, with sample/demo - UPDATED by the author asuchac43@gmail.com - 2016-06-23 23:07 -0700
    Re: JSON parser in VO, with sample/demo sherlocksoftware@gmail.com - 2016-06-24 05:12 -0700
    Re: JSON parser in VO, with sample/demo sherlocksoftware@gmail.com - 2016-06-24 05:02 -0700

#4531 — JSON parser in VO, with sample/demo

FromSherlock <sherlock@sherlock.com.au>
Date2012-12-29 00:37 -0800
SubjectJSON parser in VO, with sample/demo
Message-ID<ec132ea6-c698-49af-988c-2713bde7837a@googlegroups.com>
All VO'ers

We needed this and developed it.
If you find any issues or have JSON files that do not parse correctly please let me know.

www.sherlock.com.au/sherlock32/testjsonparser.zipx

Phil McGuinness

[toc] | [next] | [standalone]


#4532

FromSherlock <sherlock@sherlock.com.au>
Date2012-12-29 00:54 -0800
Message-ID<5401c4ac-acae-42da-bbad-9906ced0689b@googlegroups.com>
In reply to#4531
Try this instead... I have ZIPX blocked for some reason

    www.sherlock.com.au/sherlock32/testjsonparser.exe

Phil McGuinness

[toc] | [prev] | [next] | [standalone]


#7362

From"Rene J. Pajaron" <rjpajaron@gmail.com>
Date2014-10-27 19:19 -0700
Message-ID<a5ac1290-63dd-4d39-9240-8f8c98500921@googlegroups.com>
In reply to#4531
On Saturday, December 29, 2012 4:37:44 PM UTC+8, Sherlock wrote:
> All VO'ers
> 
> We needed this and developed it.
> If you find any issues or have JSON files that do not parse correctly please let me know.
> 
> www.sherlock.com.au/sherlock32/testjsonparser.zipx
> 
> Phil McGuinness

I will let you know, I will testing this one this weekend.  Thanks....

Looking forward working on json.... soonnnn

[toc] | [prev] | [next] | [standalone]


#7363

From"Marc Verkade [MITCon]" <marc@mitNOSPAMconDELETE.nl>
Date2014-10-28 03:29 +0100
Message-ID<GcD3w.253$Aj3.248@fe57.am1>
In reply to#4531
Thanx!
Greetings from sunny Curacao, Marc

"Sherlock"  schreef in bericht 
news:ec132ea6-c698-49af-988c-2713bde7837a@googlegroups.com...

All VO'ers

We needed this and developed it.
If you find any issues or have JSON files that do not parse correctly please 
let me know.

www.sherlock.com.au/sherlock32/testjsonparser.zipx

Phil McGuinness 

[toc] | [prev] | [next] | [standalone]


#7653

Frombazman@arach.net.au
Date2014-12-29 19:32 -0800
Message-ID<b3beefe4-1177-427d-8595-922ebd727918@googlegroups.com>
In reply to#4531
On Saturday, December 29, 2012 4:37:44 PM UTC+8, Sherlock wrote:
> All VO'ers
> 
> We needed this and developed it.
> If you find any issues or have JSON files that do not parse correctly please let me know.
> 
> www.sherlock.com.au/sherlock32/testjsonparser.zipx
> 
> Phil McGuinness

Hi Phil

I am very happy with your Json Class. Took me a while to write the methods to search & traverse.

Just letting you know that when the parser encounters a DblQuote followed by a DblQuote the parser fails, eg;

1. "movieName":"THE \u0022ENVY OF AUSTRALIA\u0022","movieClass":"RES+17",
2. "movieName":"THE \u0022ENVY OF AUSTRALIA\u0022 ","movieClass":"RES+17",

Using the above lines of text, 1. Fails whilst 2. succeeds because I have a 'SPACE' after the second \u0022.

In the 'ParseString()' method, it appears that 'dwNext' is incremented by 5 rather than 4 when Unicode is encountered.

         IF dwUnicode < 256
            b := BYTE(dwUnicode)
          ENDIF						
         dwNext += 4      // Have skipped the Hex Number here!
      ELSE
         b := 32
      ENDIF
   ENDIF
   cTargetStr := cTargetStr + CHR(b)
   dwNext += 1             // One more for good Measure makes 5
ENDIF 

Regards
Nick

[toc] | [prev] | [next] | [standalone]


#7659

From"Philippe Bayard (Belgium)" <philbayard@gmail.com>
Date2015-01-09 06:04 -0800
Message-ID<4c306a72-1b80-43bb-a9b2-6718cd4ebecb@googlegroups.com>
In reply to#7653
Nick, you just save my day... 
I was having exactly the same sort of trouble when getting json with html from database through json. 

Correcting the ParseString() method seems to solve my issue.

Thank you for sharing!

Phil

Le mardi 30 décembre 2014 04:32:21 UTC+1, baz...@arach.net.au a écrit :
> On Saturday, December 29, 2012 4:37:44 PM UTC+8, Sherlock wrote:
> > All VO'ers
> > 
> > We needed this and developed it.
> > If you find any issues or have JSON files that do not parse correctly please let me know.
> > 
> > www.sherlock.com.au/sherlock32/testjsonparser.zipx
> > 
> > Phil McGuinness
> 
> Hi Phil
> 
> I am very happy with your Json Class. Took me a while to write the methods to search & traverse.
> 
> Just letting you know that when the parser encounters a DblQuote followed by a DblQuote the parser fails, eg;
> 
> 1. "movieName":"THE \u0022ENVY OF AUSTRALIA\u0022","movieClass":"RES+17",
> 2. "movieName":"THE \u0022ENVY OF AUSTRALIA\u0022 ","movieClass":"RES+17",
> 
> Using the above lines of text, 1. Fails whilst 2. succeeds because I have a 'SPACE' after the second \u0022.
> 
> In the 'ParseString()' method, it appears that 'dwNext' is incremented by 5 rather than 4 when Unicode is encountered.
> 
>          IF dwUnicode < 256
>             b := BYTE(dwUnicode)
>           ENDIF						
>          dwNext += 4      // Have skipped the Hex Number here!
>       ELSE
>          b := 32
>       ENDIF
>    ENDIF
>    cTargetStr := cTargetStr + CHR(b)
>    dwNext += 1             // One more for good Measure makes 5
> ENDIF 
> 
> Regards
> Nick

[toc] | [prev] | [next] | [standalone]


#9422

Fromsudden2011@gmail.com
Date2016-06-12 18:16 -0700
Message-ID<84939c17-3581-4b64-9cdd-409a4616b72d@googlegroups.com>
In reply to#4531
Hey Phil,
Thanks a lot for writing an sharing this much needed class. Can you hit me up with a way of using it to open and search for or traverse the jsonParser object. For example, given:

{
    "successful": false,
    "response": {
        "test": true
    },
    "errors": ["Invalid Card Number"]
} 

How would I get to the (true) value of "test"?

Your samples only shows reading a file and writing it out as a text string.

Thanks! - Gerard

[toc] | [prev] | [next] | [standalone]


#9424

Fromsherlocksoftware@gmail.com
Date2016-06-13 02:23 -0700
Message-ID<42ab13dd-189f-4272-97b5-2eb41ea377e2@googlegroups.com>
In reply to#9422
Gerard

I will ask Ales to document it and supply latest source.
It has been updated since I posted this to the community.
I would have thought this syntax should work.

  lTest := jo:GetLogic("test")
 

Can you hit me up with a way of using it to open and search for or traverse the jsonParser object. For example, given:
> 
> {
>     "successful": false,
>     "response": {
>         "test": true
>     },
>     "errors": ["Invalid Card Number"]
> } 
> 
> How would I get to the (true) value of "test"?
> 
> Your samples only shows reading a file and writing it out as a text string.
> 
> Thanks! - Gerard

[toc] | [prev] | [next] | [standalone]


#9487

FromSherlock <sherlock@sherlock.com.au>
Date2016-06-23 23:37 -0700
Message-ID<2970fbba-2296-44cf-b318-e85aea38aeaf@googlegroups.com>
In reply to#9424
JSON VO code updated by Ales Suchac

JsonParser – added a simple recursive search as Gerard asked.
Technique demonstrated in the sample application, also updated.
Threw in also the class JsonSerializer.

Packaged everything, uploaded to the original URL 
http://www.sherlock.com.au/sherlock32/TestJsonParser.exe 

Have fun... report any bugs.. enjoy

ales@sherlock.com.au

[toc] | [prev] | [next] | [standalone]


#9490

FromAles Suchac <asuchac43@gmail.com>
Date2016-06-24 00:03 -0700
Message-ID<627ddbd2-3976-412c-8919-32f93d4b8384@googlegroups.com>
In reply to#9424
On Monday, June 13, 2016 at 7:23:29 PM UTC+10, sherlock...@gmail.com wrote:
> Gerard
> 
> I will ask Ales to document it and supply latest source.
> It has been updated since I posted this to the community.
> I would have thought this syntax should work.
> 
>   lTest := jo:GetLogic("test")
>  
> 
> Can you hit me up with a way of using it to open and search for or traverse the jsonParser object. For example, given:
> > 
> > {
> >     "successful": false,
> >     "response": {
> >         "test": true
> >     },
> >     "errors": ["Invalid Card Number"]
> > } 
> > 
> > How would I get to the (true) value of "test"?
> > 
> > Your samples only shows reading a file and writing it out as a text string.
> > 
> > Thanks! - Gerard

Actually, with the newest update posted today - redownload from the original link where it is saved as self-extracting ZIP, the syntax is:

LOCAL jp AS JsonParser
LOCAL a AS ARRAY
LOCAL jo AS JsonObject
LOCAL jv AS JsonValue

jp := JsonParser{}
jp:LoadFromString('{"successful":false, "response": {"test": true},"errors":["Invalid Card Number"]}')
jo := jp:RootJson:ValAsObject
a := jo:AllValuesForKey("test", TRUE)
jv := a[1]
InfoBox{,"Result", "HERE: " + AsString(jv:ValAsLogic)}:Show()

[toc] | [prev] | [next] | [standalone]


#9484

Fromsherlocksoftware@gmail.com
Date2016-06-24 05:29 -0700
Message-ID<8b740b86-d5a8-4368-bc20-0e0e61026e47@googlegroups.com>
In reply to#4531
test 123

[toc] | [prev] | [next] | [standalone]


#9485 — Re: JSON parser in VO, with sample/demo - UPDATED by the author

Fromasuchac43@gmail.com
Date2016-06-23 23:07 -0700
SubjectRe: JSON parser in VO, with sample/demo - UPDATED by the author
Message-ID<b76209fc-971f-4ca7-bba7-02aa7f37c118@googlegroups.com>
In reply to#4531
Hi all,

I am the author of JsonParser. I have updated the class JsonParser, among other things added also simple recursive search - see module Readme.

Also added a bonus class JsonParser. Updated the testing code.

Re-download the whole package from URL:

http://www.sherlock.com.au/sherlock32/TestJsonParser.exe  

Hope it helps somebody :-)

Ales Suchac - pls email me at: ales@sherlock.com.au

[toc] | [prev] | [next] | [standalone]


#9488

Fromsherlocksoftware@gmail.com
Date2016-06-24 05:12 -0700
Message-ID<f4b7a322-72da-477d-b6d6-c555703673f7@googlegroups.com>
In reply to#4531
test post

[toc] | [prev] | [next] | [standalone]


#9489

Fromsherlocksoftware@gmail.com
Date2016-06-24 05:02 -0700
Message-ID<c8df4dc8-2185-435b-ae0c-38a2931726ed@googlegroups.com>
In reply to#4531
All VO'ers

Updated JSON parser... 
 
Added simple recursive search as Gerard ask for.
It is demonstrated in the sample app, also updated. 
Another issue someone raised resolved as well

Find any issues or have JSON files that do not parse correctly please let me know.   ales@sherlock.com.au

www.sherlock.com.au/sherlock32/TestJsonParser.exe 

Ales Suchac + Phil McGuinness

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.clipper.visual-objects


csiph-web