Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/marianoguerra/jsonpath-scala
jsonpath queries for json in scala
https://github.com/marianoguerra/jsonpath-scala
Last synced: about 1 month ago
JSON representation
jsonpath queries for json in scala
- Host: GitHub
- URL: https://github.com/marianoguerra/jsonpath-scala
- Owner: marianoguerra
- Created: 2012-05-16T14:07:56.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2012-05-18T10:14:33.000Z (over 12 years ago)
- Last Synced: 2023-04-21T08:16:32.024Z (over 1 year ago)
- Language: JavaScript
- Size: 175 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rest
Awesome Lists containing this project
README
jsonpath-scala - a jsonpath implementation in scala
===================================================jsonpath-scala is an implementation of jsonpath [1] in scala.
the current implementation allows querying jsonpath to json datastructures
built with liftweb's json implementation [2][3] but the library allows supporting
other libraries just subclassing org.marianoguerra.jsonpath.JsonPath[T].this is early work and will not return the same results as other jsonpath
implementation for some cases like recursive queries like $..foo, querying
inside arrays, the value of empty results and wildcard usage.a nice next step (and a nice way of helping) would be to define a set of
language independent tests to run accross all implementations, for example
files with the query, source object and expected result as json to load on
all implementations and test for correctness.[1] http://goessner.net/articles/JsonPath/
[2] https://github.com/lift/lift/tree/master/framework/lift-base/lift-json/
[3] http://liftweb.net/
who?
----marianoguerra
why?
----I need it for one project
how?
----check it out, install sbt >= 0.11.0 and run::
git clone https://github.com/marianoguerra/jsonpath-scala.git
cd jsonpath-scala
sbt testyou can play with it in a scala REPL::
sbt console
and then some examples::
scala> import org.marianoguerra.jsonpath.liftjson.JsonPath
import org.marianoguerra.jsonpath.liftjson.JsonPathscala> import net.liftweb.json._
import net.liftweb.json._scala> JsonPath.query("$.name", "{\"name\": \"mariano\"}")
res0: Either[org.marianoguerra.jsonpath.Error,net.liftweb.json.package.JValue] = Right(JString(mariano))scala> JsonPath.query("$.name", JObject(List(JField("name", JString("mariano")))))
res1: Either[org.marianoguerra.jsonpath.Error,net.liftweb.json.package.JValue] = Right(JString(mariano))license?
--------MIT