Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

json path in C++

118 views
Skip to first unread message

Christopher Pisz

unread,
Feb 12, 2016, 11:22:29 AM2/12/16
to
Has anyone implemented an xpath equiv for json in C++?

ermehgerd, it's killing me. I cannot believe there is not already some
library that handles this.

I found jsoncpp, but it crashes when you give it a path of more than 1
level. Can't find anything else




--
I have chosen to troll filter/ignore all subthreads containing the
words: "Rick C. Hodgins", "Flibble", and "Islam"
So, I won't be able to see or respond to any such messages
---

Daniel

unread,
Feb 12, 2016, 2:11:39 PM2/12/16
to
On Friday, February 12, 2016 at 11:22:29 AM UTC-5, Christopher Pisz wrote:
> Has anyone implemented an xpath equiv for json in C++?
>
> ermehgerd, it's killing me. I cannot believe there is not already some
> library that handles this.
>
> I found jsoncpp, but it crashes when you give it a path of more than 1
> level. Can't find anything else
>
My json library jsoncons has an implementation of Stefan Goessner's
JsonPath, https://github.com/danielaparker/jsoncons/wiki/json_query. There
may be others in C++, but you're unlikely to find any json path
implementation that is as robust or industrial strength as xpath in the XML
world. Not to mention that while Stefan Goessner's JsonPath is widely used,
it doesn't have a formal specification.

An alternative would be to transform the json into an XML representation and
send it to an XPATH validator. If you have a json processor that can stream
json events, and an XPATH validator that can receive SAX events, that could
be a practical solution.

Daniel



guinne...@gmail.com

unread,
Feb 12, 2016, 6:13:39 PM2/12/16
to
On Friday, 12 February 2016 16:22:29 UTC, Christopher Pisz wrote:
> Has anyone implemented an xpath equiv for json in C++?
>
> ermehgerd, it's killing me.

<snip>

"ermehgerd"? What is that? Even the mighty Google can't help me.

Christopher Pisz

unread,
Feb 12, 2016, 7:24:41 PM2/12/16
to

Christopher Pisz

unread,
Feb 12, 2016, 7:26:00 PM2/12/16
to
On 2/12/2016 5:12 PM, guinne...@gmail.com wrote:
Alternatively, you may use this
http://ermahgerd.jmillerdesign.com/#!/translate

Mr Flibble

unread,
Feb 12, 2016, 7:29:36 PM2/12/16
to
On 13/02/2016 00:24, Christopher Pisz wrote:
> On 2/12/2016 5:12 PM, guinne...@gmail.com wrote:
>> On Friday, 12 February 2016 16:22:29 UTC, Christopher Pisz wrote:
>>> Has anyone implemented an xpath equiv for json in C++?
>>>
>>> ermehgerd, it's killing me.
>>
>> <snip>
>>
>> "ermehgerd"? What is that? Even the mighty Google can't help me.
>>
>
> Google shows me this:
> http://cosmouk.cdnds.net/15/43/980x490/landscape-1445262691-970.jpg

Oh my fucking God?

/Flibble


Christopher Pisz

unread,
Feb 12, 2016, 7:43:06 PM2/12/16
to
I will check it out. Thank you sir.

Robve

unread,
Mar 4, 2016, 8:18:41 AM3/4/16
to
Have you tried the JSON and JSONPath implementation at http://www.genivia.com/doc/xml-rpc-json/html that converts JSONPath queries to C++ code? Works quite well and is faster than a library and certainly faster than converting to XML.

Robve
--



Christopher Pisz

unread,
Mar 4, 2016, 10:19:44 AM3/4/16
to
I found GSoap to be a pain in my buttocks and have since switched to
using the WinAPI for web services, since I am targeting windows only.

Since the oringinal post I made, I have worked out how to implement my
own json path, since the libraries I was using don't offer it. Twas
quite the challenge.
0 new messages