Writing a Dataset JSON

Post Reply
Sunnyland
Member
Posts: 56
Joined: Mon Aug 19, 2013 1:34 am

Writing a Dataset JSON

Post 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 3701 times
My JSON seems to be formatted correctly and I'm not sure why Switch is expecting "<"

Has anyone got any idea's?
Padawan
Advanced member
Posts: 358
Joined: Mon Jun 12, 2017 8:48 pm
Location: Belgium
Contact:

Re: Writing a Dataset JSON

Post 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.
Sunnyland
Member
Posts: 56
Joined: Mon Aug 19, 2013 1:34 am

Re: Writing a Dataset JSON

Post 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.
Post Reply