JSON field names with periods

Homepage Clovertech Forums Cloverleaf JSON field names with periods

Tagged: ,

  • Creator
  • #118513
    Matthew Rasmussen

    If I have a JSON schema that includes periods in field names, the periods get parsed into structural components of the output JSON.  For instance this:

    “MSH”: {
    “MSH.1”: “|”,
    “MSH.2”: “^~\&”,

    …parses as this in translation:

    Is there a way to specify literal periods in the field names, without them getting parsed as structural components?

Viewing 1 reply thread
  • Author
    • #118524
      Jim Kosloskey

      I am not a JSON expert and have done little work with JSON.

      However a little reading on the web indicates periods (dots) in JSON field names may be representative of  a structure and thus not allowed to actually be part of a field name – which is what I think you are seeing via the Xlate.

      The recommendation I saw was to use underscore in place of the period (dot).

      If this is a Schema you built then I would try to replace the periods in field names with underscore.

      If someone else built this schema, then I would try to validate it in one of the free online JSON Schema validation tools. If one or more of the tools indicate an issue with the period (dot), I would present that evidence to the originator of the schema and suggest they send a corrected schema.

      email: jim.kosloskey@jim-kosloskey.com

    • #118525
      Matthew Rasmussen

      Hi Jim,

      Funny story – I actually rebuilt the schema yesterday exactly as you suggested, with the underscores – great minds…  I’ll have to get the vendor’s blessing, but we’re redesigning the API in question anyway, so it shouldn’t be too hard to sell.  Especially if I take your additional advise and prove that these names don’t observe JSON best practice.  You can’t blame Cloverleaf for following the rules to the letter. I appreciate you sharing your wisdom and advise!

Viewing 1 reply thread
  • You must be logged in to reply to this topic.

Forum Statistics

Registered Users
Topic Tags