?
Solved

XMLquire and JSON

Posted on 2013-11-03
9
Medium Priority
?
311 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 1600 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
How To Reduce Deployment Times With Pre-Baked AMIs

Even if we can't include all the files in the base image, we can sometimes include some of the larger files that we would otherwise have to download, and we can also sometimes remove the most time-consuming steps. This can help a lot with reducing deployment times.

 
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
 

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 400 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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Suggested Courses

777 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