For some time I have been using an UnmanagedExports wrapper around JsonTextReader and JsonTextWriter from Json.NET which was quite handy but had limitations.
Today I have added the ability to Querying JSON with SelectToken which so far is pretty damn awesome!
Consider this JSON data for input:
I can do things like this:
i=-1 ! remember zero based arrays in .NET
vehicleRego = Json.SelectToken('solutions[' & i & '].rego')
IF vehicleRego = ''
! We are done with the solutions, see ya!
Debug.Message('Vehicle Rego: ' & vehicleRego)
Of course at the moment it considers everything a string on the .NET side and relies on Clarion data conversions which might bite me at some point but I image you could do something like
Json.SelectToken('solutions.ChildSomething.MoneyField', EQUATE_TYPE:DECIMAL) and add a bit of handling on the other end to deal with different data types or whatever.
Anyway, I thought is was pretty cool and worth a share. With this I can react to incoming Json data in a very dynamic way without lots of pain. Yay!