How do you check your exported JSON and XML files?

I wrote these years ago, and I was wondering if another program / softare is able to read them.

The data comes from a SQLite file.

So, I exported the data to JSON and XML files, then drop them into a Firefox browser page…

Both files appears correctly. Can I consider them as valid files ?

How did you make them? Using XML and JSON components or using your custom routines?
Built without errors using professional components probably are safe.

A way to check small unknown XML/JSON streams is using an online parser like THIS ONE that converts XML to JSON and back and reports broken ones.

Thank you Rick.

Pure Xojo code. At the time I exported to and Imported from with success, but this only means they works together.

I will try your online parser.

NB: Firefox does not show any reading error: I looked (fast) at the file and the last “record” is as good as the first one.

Last entry in the JSON file, loaded in FireFox:


(dates neans nothing, sample data).

XML entry (Firefox too):

Firefox is not a tool for such tests. If you try to render something broken as

<aaa>
  <bbb>
  </bbb>

It just says : “OK, done”.

You could write a reader in Xojo. Using their XML / JSON classes.

Bad streams probably will rise up exceptions about malformation at the internal parsing step.

OK.

www.utilities-online.info says nothing when I press the XML to JSON button, it only generates a JSON file from the copied XML.

I introduced an error in my XML text (I removed an ending tag) and I get a warning about it. It seems my XML is correct.
JSON to XML convert does not make an error too.

So it seems safe at structural level, if you have problems in the future, they could occur at data level, like not correctly encoded strings with non-printable ASCII for example.

Fine. Thank you.

1 Like

some tool like bbedit (free version) will let you validate xml structure
or an online tool made for xml validation like

If you don’t like online tools, because you have to give them your data, you can use (the trial version of) a small xml tool for macOS: xmplify

I use Oxygen https://www.oxygenxml.com for all my xml work… It is not cheap but has an extensive feature set… including SOAP, XSLT and JSON conversions.

and https://jsonlint.com/

give them your data:
I do not care about the data because it comes from a csv I found in the internet, is outdated and the people in this data are Politicians… :innocent:
I only had to move some columns (First Name / Family Name, Birth Dates) to be in tune with my display ListBox…

Why working with two or three Records when you can get hundred for free (575 to be exact in this case) !!!

That said, I do not imagined there was web site that “validate” (or reject) this kind of stuff.

BTW: about encoding; I have in the first line of the xml exported file:


<?xml version="1.0" encoding="UTF-8"?>

The original text was encoded as UTF-8 at import time, so I suppose its Encoding is UTF8 in JSON too…