Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6599127
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:27:00+00:00 2026-05-25T18:27:00+00:00

So I am using a jQuery plugin (jsonp) to make a cross-domain call to

  • 0

So I am using a jQuery plugin (jsonp) to make a cross-domain call to an api and getting JSON data back. I need to somehow get this data into my XQuery page. I’m using Marklogic server to store all my XML data and I know it has some XDMP functions to handle JSON data, it is getting the JSON from javascript to XQuery that is giving me a pain.

Any ideas on how to go about this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T18:27:01+00:00Added an answer on May 25, 2026 at 6:27 pm

    I’m not 100% sure what is giving you problems but will try to offer up a solution that will hopefully get you on your way.

    There is an open source project on GitHub called MLJSON (https://github.com/marklogic/mljson/wiki). It can take a JSON string, parse it and return an XML document that MarkLogic can easily make use of.

    If understanding the internal structure of the XML isn’t appealing (even though it is fairly straightforward, it is undocumented), the project also includes a path parser to extract bits out of the parsed JSON document. Here’s a quick sample XQuery page that will take some JSON sent to the server as a POST or GET parameter, parse it and pull out a value:

    xquery version "1.0-ml";
    
    import module namespace json="http://marklogic.com/json" at "lib/json.xqy";
    import module namespace path="http://marklogic.com/mljson/path-parser" at "lib/path-parser.xqy";
    
    let $jsonString := xdmp:get-request-field("json")
    let $jsonXML := json:parse($jsonString)
    let $firstName := path:select($jsonXML, "author.firstName", "json")
    
    return concat("First name: ", $firstName)
    

    If the above script is passed a JSON document like:

    {
        "author": {
            "firstName": "Noam",
            "lastName": "Chomsky"
        }
    }
    

    It will return the string: “First name: Noam”.

    MLJSON has a number of other features that I won’t go over here, but will mention that it has functions to construct JSON objects, arrays, etc and serialize them out as a JSON string.

    Hope that helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on creating a RESTful API that supports cross-domain requests, JSON/JSONP support,
I am using the JQuery json plugin and trying to convert a custom object
So I need to make a a cross domain request where the response is
I need to make an ajax POST request (json) to a different domain (later
I'm using the autocomplete jQuery plugin ( api doc ) that calls a service
I'm using jquery and the jquery-json plugin found here: http://code.google.com/p/jquery-json/ I've checked at http://jsonlint.com/
I am using jqgrid (jquery plugin), and using json format to return the results
I have an ajax call (JSONP) using JQuery with GET method. I think because
Having trouble getting a form using PHP, JQuery Form plugin, and JQuery Validate plugin
I want to show events using the JQuery fullcalendar plugin (version 1.5.2). The JSON

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.