Hi Sini,

Please try below code

json:transform-from-json($json-query)//*:constraint-name


Regards,
Asit Nautiyal

From: [email protected] 
[mailto:[email protected]] On Behalf Of sini narayanan
Sent: Wednesday, October 09, 2013 4:37 PM
To: MarkLogic Developer Discussion
Subject: [MarkLogic Dev General] Parsing json query

Hi All,

I have a json query string and I performed 
json:transform-from-json($json-query). I get the below output.

<json type="object" xmlns="http://marklogic.com/xdmp/json/basic";>
  <query type="object">
    <and-query type="object">
      <queries type="array">
            <json type="object">
             <range-constraint-query type="object">
               <constraint-name type="string">country</constraint-name>
               <value type="array">
                 <item type="string">FRA</item>
               </value>
             </range-constraint-query>
            </json>
            <json type="object">
             <range-constraint-query type="object">
               <constraint-name type="string">TravelType</constraint-name>
               <value type="array">
                 <item type="string">TOURISM</item>
               </value>
             </range-constraint-query>
            </json>
      </queries>
    </and-query>
  </query>
</json>

How do I traverse through the output xml to get each constraint-name node.
I tried normal xpath on this output 
json:transform-from-json($json-query)//constraint-name. But this doesnot work.

Please help.

Thanks.
This e-mail and any files transmitted with it are for the sole use of the 
intended recipient(s) and may contain confidential and privileged information. 
If you are not the intended recipient(s), please reply to the sender and 
destroy all copies of the original message. Any unauthorized review, use, 
disclosure, dissemination, forwarding, printing or copying of this email, 
and/or any action taken in reliance on the contents of this e-mail is strictly 
prohibited and may be unlawful.
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to