Discussion:
json path in C++
(too old to reply)
Christopher Pisz
2016-02-12 16:22:17 UTC
Permalink
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
2016-02-12 19:11:07 UTC
Permalink
Post by Christopher Pisz
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
Christopher Pisz
2016-02-13 00:42:48 UTC
Permalink
Post by Daniel
Post by Christopher Pisz
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
I will check it out. Thank you sir.
--
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
---
g***@gmail.com
2016-02-12 23:12:59 UTC
Permalink
Post by Christopher Pisz
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
2016-02-13 00:24:27 UTC
Permalink
Post by g***@gmail.com
Post by Christopher Pisz
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:
Loading Image...
--
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
---
Mr Flibble
2016-02-13 00:29:36 UTC
Permalink
Post by Christopher Pisz
Post by g***@gmail.com
Post by Christopher Pisz
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.
http://cosmouk.cdnds.net/15/43/980x490/landscape-1445262691-970.jpg
Oh my fucking God?

/Flibble
Christopher Pisz
2016-02-13 00:25:51 UTC
Permalink
Post by g***@gmail.com
Post by Christopher Pisz
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.
Alternatively, you may use this
http://ermahgerd.jmillerdesign.com/#!/translate
--
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
---
Robve
2016-03-04 13:18:25 UTC
Permalink
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
2016-03-04 15:19:16 UTC
Permalink
Post by Robve
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
--
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.
--
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
---
Continue reading on narkive:
Loading...