jq exists, is fast, and works well. Is this compatible?
JMESPath – A query language for JSON
71–80 of 131 posts
Re: JMESPath – A query language for JSON
#72why choose this over jsonpath (like xmlpath) or jq?
Re: JMESPath – A query language for JSON
#73Does this have any mathematical foundation like the relational algebra for SQL? Or more generally, does a mathematical framework exist to treat this or similar constructs and that goes beyond what relational algebra provides and that, for example, also handles aggregate functions? The reason I am asking is that I am currently trying to build a tool to analyze a kind of time series data, think log file entries, in ord…
What reasons did you not go with SQL itself? I may not fully understand what you're trying to do, but in any case it sounds really interesting.
The other thing is that SQL seems not the best fit to me. Say you just want to know how many events occurred in the last three months in any hour, that is straight forward grouping and counting at first, but already rounding the timestamps to an hour is not as obvious as it should be. But if there was no event in a specific hour, your result will just have no row for that hour instead of a row saying there were zero events in that hour. This in turn will cause more trouble if you want to build a histogram showing in how many hours there were say 0 to 9, 10 to 19, 20 to 29, and so on events. Certainly still doable with SQL but we are already entering the territory where writing a single query will take most people several hours to get the desired result.
I also couldn't easily tell how to express calculating the 99th percentile of the event size for every day of the week and hour of the day. I am pretty sure it is possible but I guess it would also be pretty unreadable unless you put in quite a bit of effort to create utility functions instead of hacking together one huge SQL statement. Then again I don't really know much about the more recent SQL features for partitioning and aggregating, maybe I should have a closer look at that first.
Re: JMESPath – A query language for JSON
#74Re: JMESPath – A query language for JSON
#75Earlier quoted context omitted.
> and cannot be serialized like jsonlib.encode(foo) Huh? Could have fooled me. In Cocoa, for example, serializing to JSON and serializing to an XML property list (or binary property list) is effectively the same code. https://developer.apple.com/documentation/foundation/nsjsons... https://developer.apple.com/documentation/foundation/nsprope...
Yes, but property list is a subset of XML and Cocoa’s almost internal format. It doesn’t even connect keys to values, probably losing all the xpath/xslt/etc abilities. No custom schema too?
And of course that is why some of the XML tools are so heavy: they deal with the full meta-format. The "nice" thing about JSON is that it doesn't have this indirection step, it's just one concrete language, and that's why it is simple. But again, it's trivially easy to define an actual concrete markup language using XML that is just as simple.
I agree with you that the choice of theKeyvalue rather than value was regrettable, had I designed the format I would have chosen differently. I think they wanted one DTD to describe this format, which wouldn't have been possible without keeping the meta-level indirection.
I created XML-based archivers for Cocoa that don't have this problem[2]. Again, this wasn't hard, and the API is NSKeyedArchiver compatible, so [MPWXMLArchiver archivedDataWithRootObject:someObject]; gets you a nice XML representation.
[1] http://www.xml.com/pub/a/98/10/guide0.html?page=2
[2] https://github.com/mpw/Objective-XML/blob/master/MPWXmlArchi...
Re: JMESPath – A query language for JSON
#76jq exists, is fast, and works well. Is this compatible?
Re: JMESPath – A query language for JSON
#77Might be useful if you are testing API or playing with JSON data.
Re: JMESPath – A query language for JSON
#78Besides's this projects cli, jp ( https://github.com/jmespath/jp ), I see jl ( https://github.com/chrisdone/jl ) and jq ( https://github.com/stedolan/jq/ ) in the comments. I wonder if anyone has had experience with all three (or even just one) and can comment on their experiences?
Re: JMESPath – A query language for JSON
#79Earlier quoted context omitted.
It's not very much less verbose, really. You still need a key and a value. The only thing you lose, really, is the end tag. For a complex text document in say TEI or Docbook, I don't see how this is much of an advantage.
It's less complex since there aren't attributes. Of course, if you like attributes, then that's a downside.
Re: JMESPath – A query language for JSON
#80I built this VS Code plugin to convert JSON interactively using JMESPath: https://marketplace.visualstudio.com/items?itemName=octref.v... Might be useful if you are testing API or playing with JSON data.