Re: [Bots Open Source EDI Translator] JSON output lists of 1 showing, how to get rid of brackets?

55 views
Skip to first unread message

Eppye Bots

unread,
Dec 8, 2024, 7:02:40 AM12/8/24
to bots...@googlegroups.com
no, there is no way to stop this now.
kind regards, Henk-Jan Ebbers


On Sun, Dec 8, 2024 at 2:35 AM Zeik <djad...@gmail.com> wrote:
Hi All,

Trying to see if I am defining the structure wrong or if I need to do postprocessing to remove these [ ] when there is only 1 element in a record from my JSON file.  The below structure

structure = [
       
    {ID:'PO850',MIN:1,MAX:1,
    QUERIES:{
'frompartner': get_frompartner,
        'topartner':    get_topartner,
        },
    LEVEL:[
    {ID:"from_partner",MIN:1,MAX:1},
    ]},
    ]

is producing this

{
    "PO850": {
        "po_date": "10/23/2024",
        "from_partner": [
            {
                "city": "TESTCITY",
                "name": "TEST",
                "zip": "11111",
                "address1": "2365 Ave",
                "state": "XX",
                "id": "999999999"
            }
        ]
    }
}

even though from_partner is only MIN/MAX of 1, it puts it in a list [ ].  

Is there a way to stop this?
Can I have just multiple roots or there has to be only one, since PO850 seems to place things in { } only and not a list [ ]?

Thanks

--
You received this message because you are subscribed to the Google Groups "Bots Open Source EDI Translator" group.
To unsubscribe from this group and stop receiving emails from it, send an email to botsmail+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/botsmail/ac077c45-9919-4bfd-a500-1623be7efc4dn%40googlegroups.com.

Zeik

unread,
Dec 8, 2024, 2:02:50 PM12/8/24
to Bots Open Source EDI Translator
No problem, I was able to write a little function to remove them in a communication script.  I have another post that I am trying to understand how to write the new file out from the communication script to the channel path.
Reply all
Reply to author
Forward
0 new messages