Page 1 of 1

Writing a Dataset JSON

Posted: Wed Sep 16, 2020 8:31 am
by Sunnyland
So I want to write a JSON dataset.

Using await job.createDataset("iqdata",JSONpath,DatasetModel.JDF);

and writing this JSON Data

{
"job": [{
"impositionwidth": "210.0000",
"impositionheight": "297.0000",
"sectionnumber": 0,
"finishedwidth": "210.0000",
"finishedheight": "297.0000",
"pages": "2",
"foldtype": "Flat Product",
"press": "HP Indigo 7900",
"presspath": {},
"stock": "150gsm Test Stock",
"Stockmatch": {},
"printquantity": {},
"processfront": "CMYK",
"processback": "CMYK",
"artworkname": "Artwork",
"thissection": {}
}]
}

It attaches to the job correctly and I can see in the dataview but when I try to view it I get this error
Untitled.png
Untitled.png (24.29 KiB) Viewed 3750 times
My JSON seems to be formatted correctly and I'm not sure why Switch is expecting "<"

Has anyone got any idea's?

Re: Writing a Dataset JSON

Posted: Wed Sep 16, 2020 8:49 am
by Padawan
Switch is only able to read XML (and XML derrivates) as dataset. Datasets from other formats are "just" a way to attach a file to a job, you can't read from it.

There are some node js packages to convert json to xml, I think it is best if you use one of them and then store an XML dataset.

Alternatively, there are also apps to convert json to xml.

Re: Writing a Dataset JSON

Posted: Wed Sep 16, 2020 8:55 am
by Sunnyland
Thanks for the info,
I also realized that I have set the datasetmodel set to JDF rather than JSON which didn't help my cause. I will convert to XML just try to take the easy way out.