Solved

XMLquire and JSON

Posted on 2013-11-03
9
286 Views
Last Modified: 2013-11-24
Hello,
I would think that a search on the internet would result in getting my question answered, but I did not find it.
My question is this; is there a tool like XMLQuire that does the same for Json?  
I looked to see if xmlquire can provide the xpath for a json file?

Might you know of one?
0
Comment
Question by:chima
  • 5
  • 3
9 Comments
 

Author Comment

by:chima
ID: 39620577
I found jsonPath, yet I do not think that it generates the xpath.  It generates or uses it own path syntax to get the elements.  I need the xPath for a Json file; http://goessner.net/articles/JsonPath/
Comments?

Might jsonEditor provide the xpath?
http://xmlgrid.net/jsonEditor.html
0
 
LVL 30

Accepted Solution

by:
Alexandre Simões earned 400 total points
ID: 39621188
What do you need to accomplish with a hypothetic jsonPath?
Is this a backward compatibility issue? You had XML now you have JSON and want everything to work as smooth as possible?

The main problem is that JSON and XML are not directly compatible, meaning that not all XPath operators will work on both.

Explain me better what you're actually trying to accomplish.
0
 

Author Comment

by:chima
ID: 39621515
AlexCode
jsonPath is not hypothetical; http://goessner.net/articles/JsonPath/, yet one should ask whether it is approved by the W3C.

I believe this statement clarifies this;"The main problem is that JSON and XML are not directly compatible, meaning that not all XPath operators will work on both."

This is why jsonpath has different symbols:
elements with its XPath counterparts.

XPath  JSONPath  Description  
/          $                   the root object/element  
.          @                  the current object/element  
/       . or []              child operator  
..        n/a                parent operator  
//         ..                  recursive descent. JSONPath borrows this syntax from E4X.  

etc, etc...

Therefore, it is possible that xpath for Json does not exist.
0
 
LVL 30

Expert Comment

by:Alexandre Simões
ID: 39621558
For me it's clear that XPath for JSON doesn't exist.
XPath is designed to transverse XML documents not JSON.
As you also agreed, XML and JSON are two completely different formats, which takes me back to the main question of my post that you didn't answer:

What are you trying to achieve?
Why do you need XPath notation to transverse JSON, even knowing in advance that it can never be consistent?
0
Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

 

Assisted Solution

by:chima
chima earned 0 total points
ID: 39622006
Alexcode, I do apologize that I did not answer your question.  I'm not an expert with xpath, nor using xpath, but let's assume that there is an app that accepts xml files as its data input by using the xpath from the xml file.  Now let's say that the input file changes to be a json format, but the app still uses xpath to get the data.  Then I would need to get the data from the json file using xpath.  

Maybe there is a json-path to xpath converter?
This thought comes to mind because xmlquire generates the xpath for the xml.  Then I thought that there might be; jsonquire generates the xpath from the json.
Now I know there isn't such a "process/tool/app" because the formats are different.
Thank you for your comments.  Your points are coming shortly.
0
 
LVL 44

Assisted Solution

by:Rainer Jeschor
Rainer Jeschor earned 100 total points
ID: 39622036
Hi,
why not converting JSON to XML? Then you can still use the existing XPath processing.
Like
http://code.google.com/p/x2js/

But still: where do you get the JSON from? What is your "workflow" / business process?
Which coding / technologies are used?

Just my 2ct.
Rainer
0
 
LVL 30

Expert Comment

by:Alexandre Simões
ID: 39623000
Hi mate.

In my opinion you'll have much less trouble if you just rewrite the logic for the new data format (JSON).
The best approach would be, in my opinion, to abstract the file reading code so that you could still call the appropriate reader depending on the received file format (XML, JSON or whatever new format it might come in the future).

I understand that you want to touch the code the less possible, but if you want to do it properly just rewrite that bit of code that reads the file.
0
 

Author Comment

by:chima
ID: 39659418
This is a "body"?
0
 

Author Closing Comment

by:chima
ID: 39672353
I do apologize for the delay/forgetting to get back to this question.  Thank you for the clarification.  Alexcode, yes rewriting the code would be better for it to accept all formats.
0

Featured Post

[Webinar] Disaster Recovery and Cloud Management

Learn from Unigma and CloudBerry industry veterans which providers are best for certain use cases and how to lower cloud costs, how to grow your Managed Services practice in IaaS clouds, and how to utilize public cloud for Disaster Recovery

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now