Leave feedback
  • Question

    Creating a JSON file in 5.5.

Enter a new topic
  • Luke Francis Luke Francis
    0 likes 572 views

    We are doing an update to the data file our Purchase order project produces, so that it is more future proof.

    We are looking to create a JSON file, but I am running into issues getting the file to structure, especially when it comes to subsetting things like the the Buyer, seller and ship to addresses.

    Has anybody  else produced a JSON file, which process did you use to produce it, and how did you handle the data that needed to be be indented in. 

    Tuesday 09 May, 2017
  • Andreas Hjelle Andreas Hjelle
    0 likes

    Hi,

    JSON are text so you could either use StreamOUT (if you love that interface…) or simply build it in a function file or script. I prefer the latter for small files. Then use the desired connector, for instance HTTPsubmit.

    Regards,

    andreas

    Tuesday 09 May, 2017
  • Vyv Lomax Vyv Lomax Administrator
    0 likes

    If your data is in XML then you could call an XML to JSON converter. Search online for such a tool.

    Wednesday 17 May, 2017
  • Luke Francis Luke Francis
    0 likes

    The files being produced will be purchase orders, and could have up to 99 order lines on them. In addition we do about 3000 orders a day, so anything we do has to be as efficient as possible. The data is stream in, so I would have to convert it to XML to use the XML -> JSON converter, then try to use streamserve to pick up the data and send it via https.

    I tried the streamout option, but it errors due to the to all of the descriptions having quote marks (") around them (e.g. "OrderNumber": 12345) Apart from using java, any suggestions on fixing that?

    Friday 21 July, 2017
  • Peter Martens Peter Martens StreamServe Employee
    0 likes

    Hi, 

    Have you tried the template engine?

    Regards
    Peter

    Friday 21 July, 2017
  • Jesper Werge Jesper Werge StreamServe Employee
    0 likes

    Hi 

    Template engine is what you are looking for, just as Peter Martens is writting, it is really easy to start using and in your option, you can create any output format you like.

     

    /Jesper

    Monday 24 July, 2017
  • Andreas Hjelle Andreas Hjelle
    0 likes

    The double quotes are solved by sending hex values instead

    $myVar = "<22>" + $myVar + "<22>";

    See this: http://onlinehelp.streamserve.com/5.6.2/en/wwhelp/wwhimpl/js/html/wwhe lp.htm#href=Scripting%20reference/ScriptingFunctions.2.211.html and this http://onlinehelp.streamserve.com/5.6.2/en/wwhelp/wwhimpl/js/html/wwhe lp.htm#href=Scripting%20reference/ScriptLangRef.1.34.html for escape sequences.

    Regards,

    andreas

    Thursday 27 July, 2017