Hi, Will:

You can use json:object() instead of map:map() for a mutable object where order 
is important.

I think the API is the same as that of map:map otherwise.

JSON nodes, like XML nodes, are immutable.

Erik Hennum

________________________________________
From: [email protected] 
[[email protected]] on behalf of Will Thompson 
[[email protected]]
Sent: Tuesday, March 10, 2015 5:09 PM
To: MarkLogic Developer Discussion
Subject: [MarkLogic Dev General] Constructing JSON objects

Is there a nice way to construct a JSON object similar to how maps can be 
constructed? Typically I would just do it this way:

xdmp:to-json(
  map:new((
    map:entry('x', 1),
    map:entry('y', 2)
  )))

Except that order is important in this specific scenario, and this ruins 
ordering.

-Will
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to