Questions tagged [jsoniq]

JSONiq is a query and processing language specifically designed for the popular JSON data model.

JSONiq is a query and functional programming language that is designed to declaratively query and transform collections of hierarchical and heterogeneous data in format of JSON, XML, as well as unstructured, textual data.

JSONiq is an open specification published under the Creative Commons Attribution-ShareAlike 3.0 license. It is based on the XQuery language, with which it shares the same core expressions and operations on atomic types. JSONiq comes in two syntactical flavors, which both support JSON and XML natively.

  • The JSONiq syntax (a superset of JSON) extended with XML support through a compatible subset of XQuery.
  • The XQuery syntax (native XML support) extended with JSON support through a compatible subset (the JSONiq extension to XQuery) of the above JSONiq syntax.

Main website: http://www.jsoniq.org

(Source)

36 questions
1
vote
2 answers

access object in an object array in jsoniq

New to JSONIQ,and using zorba what I want to do so far is to extract some information from an indexed object in an object array in JSONIQ. Here's the code so far. jsoniq version "1.0"; let $bstore:={ "bookstore": { "book":[ …
diggledoot
  • 691
  • 8
  • 22
1
vote
2 answers

How do I import a JSON file into a JSONiq collection?

I have looked everywhere, and even the JSONiq documentation says "this is beyond the scope of this document." I have a JSON file (an array of JSON objects) I want to import into JSONiq (particularly Zorba, which by the way is a terrible name…
wm_g
  • 25
  • 5
1
vote
1 answer

JSONiq console.log or print

Is it possible to print to console for debugging purposes in a JSONiq/Zorba script? e.g. declare function utils:lowerCaseKey($obj as item) as item{ print($obj) {| for $k in distinct-values(keys( $obj )) return { lower-case($k) :…
Ben Flowers
  • 1,434
  • 7
  • 21
  • 49
1
vote
1 answer

JSONiq with Zorba HMAC

I'm running the following code using the fcavalieri/zorba docker image. hmac:compute("The quick brown fox jumps over the lazy dog", "key" ,"SHA256") produces: 97yD9DBThCSxMpjmqm+xQ+9NWaFJRhdZl0edvC0aPNg= which when base64 decoded returns garbage…
Ben Flowers
  • 1,434
  • 7
  • 21
  • 49
1
vote
1 answer

jsoniq - empty() function to determine if attribute is present

I use try.zorba.io My code (simplified) is: jsoniq version "1.0"; let $tweets := [ { "id" : 1, "user" : { "id" : 1111, "screen_name" : "Bobby" } }, { "id" : 2, "user" :…
1
vote
1 answer

JSONiq count duplicates in array

I want to count duplicate values with JSONiq. I have following code: jsoniq version "1.0"; import module namespace fetch = "http://zorba.io/modules/fetch"; let $tweets := parse-json(fetch:content("/tweets.json")) let $users :=…
MagikarpSama
  • 323
  • 1
  • 11
1
vote
2 answers

Insert into JSON using JSONiq

We are writing a JSONiq query to insert new properties into a JSON and return the updated JSON from the query. Query: jsoniq version "1.0"; let $users := { "name" : "Deadbeat Jim", "address" : "1 E 161st St, Bronx, NY 10451", "risk tolerance"…
1
vote
1 answer

SQL Query to JSONiq Query

I want to convert an SQL query into a JSONiq Query, is there already an implementation for this, if not, what do I need to know to be able to create a program that can do this ?
user2202810
1
vote
1 answer

Using Jsoniq to display some of the string in json

Can you guys teach me on how to use jsoniq to display both of the book name which is robin cruose and tom jones? i've gone through some research but no matter how i do, it's always wrong. { "books": { "reader": { "Read": { …
Detonator
  • 73
  • 1
  • 9
1
vote
1 answer

Why it returns last element only in JSONiq?

Images of my json and query Json code { "reading_list": { "book": { "name": "Fifty shades of grey", "author": "E.L James", "date": "March 2015", "comment": "did not like it very much" …
stardust
  • 13
  • 4
1
vote
1 answer

Transforming SOAP Output to JSON issue

I called a SOAP service and like to transform it to a JSON using XQuery but always the result said that there are error tokens: This is the SOAP:
abu taha9
  • 45
  • 14
1
vote
0 answers

Decode a base64 string in xquery

We are trying to decode the encoded string in xquery. I didnt know how to decode the string. Following is the xquery. this basically converts xml to json and we should also need to do the decoding. declare namespace output =…
mnvbrtn
  • 558
  • 1
  • 8
  • 27
0
votes
1 answer

Storing an object with key value pairs in a variable in JSONiq

This is a sample JSON array "transcript":[ { "dcode": "CS", "cno": 211, "ssn": 82, "grade": "A" }, { "dcode": "CS", "cno": 211, "ssn": 75, "grade": "A" …
user15954051
0
votes
1 answer

How do I fix the Jsoniq static error: invalid expression: syntax error, unexpected "every"?

I am performing this query to see if there is any multimedia software packages available in this pretend database let $swpackages := [ {"name": "flimber", "version": 1.8, "category": "admin"}, {"name": "quack", "version": 5.4, "category":…
harvey2011
  • 39
  • 4
0
votes
1 answer

Are the JSONiq documentation code snippets valid?

I was trying some examples from the JSONiq document, but it throws error for some of the snippets from the document. I have installed jsoniq (version 0.0.8) using npm. Tutorial/Document link Example : if(1 + 1 eq 2) then { "foo" : "yes" } else {…
rvd
  • 337
  • 1
  • 3
  • 15