Json Serialization without "rows"

3 views
Skip to first unread message

Doug White

unread,
Sep 26, 2025, 12:34:08 AM (4 days ago) Sep 26
to openroa...@googlegroups.com
Hi All,

Is it possible using the JsonHandler.Object2JsonObject and JsonHandler.Write to create a json blob that doesn't contain the excess "rows" attribute. 

{
    "some_prop": "works great!",
    "some_array": {
        "rows": [
            {
                "some_attribute": "this is annoying!"
            }
        ]
    }
}

It's extremely annoying when you have a defined API you need to hit and want to serialize a json body that complies to the defined schema.

If anybody can provide a way that i can avoid this it would be much appreciated, I'd rather not assemble json by hand if i can help it.

Thanks
Doug White

Bodo Bergmann

unread,
Sep 26, 2025, 3:28:09 AM (3 days ago) Sep 26
to openroa...@googlegroups.com
Hi Doug,

since patch 16031 (for Windows 64-bit) there is the new JsonHandler Attribute GenValueOnlyForSysClassObject available.
Set it to TRUE before using the NewJsonValue() or Object2JsonValue() methods for JSON serialization.

Note: When using this you won't get a "row_class" attribute (for arrays being of subclass of the defined class).

HTH.
Cheers,
Bodo

Bodo Bergmann

Engineering Architect | OpenROAD Engineering

Actian, a division of HCLSoftware

actian.com    hcl-software.com

GESELLSCHAFTSANGABEN: Actian Germany GmbH | Sitz der Gesellschaft: Halenreie 40, 22359 Hamburg | Geschäftsführer: Shobhit Agarwal, Sushant Jain | Handelsregister: HRB 135991 | Amtsgericht Hamburg | USt-IdNr: DE252449897


--
You received this message because you are subscribed to the Google Groups "OpenROAD Users Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openroad-user...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/openroad-users/CAEOWWi8Yym4QuqhHC5b%2Br6%3D-2CqkyyFApFP6zLMCZ5RGCRYyVQ%40mail.gmail.com.

Doug White

unread,
Sep 26, 2025, 4:24:35 AM (3 days ago) Sep 26
to openroa...@googlegroups.com
Thanks Bodo, that's solved it.

I actually had found that setting in the docs, but stupidly was setting it AFTER the Object2JsonValue call (did it just before the JsonHandler.Write call instead) :facepalm.

Thanks for the assistance.

Kind regards
Doug White

Reply all
Reply to author
Forward
0 new messages