2

How much trouble am I asking for in allowing for very large strings in attributes of json data?

I went and looked at the maximums for the string in json strings. I cannot see any real limitations. I did see if sending json data to a browser that it should not be more than 40MB. That seems excessive. I also checked my internal data types. The string can hold 2GB. Then there is a the server it will be served from in OPCUA. Which I saw discussion of strings in the 77KB range.

We are using a json file to configure what points to read from a modbus device. I am adding fields for name and notes. I could limit these fields, but part of me wants to see if some customer tries to make the world burn. For the most part we will be editing this file. But the customer may want to as well.

Comments
  • 1
    As per the json spec you don't have any limits really, so it all comes down to who is doing the marshalling.

    If using SAX parsers you can have strings as big as your heap allows, since that's what's being kept in memory at a time.

    If using other parsers you must ensure the whole json object fits in memory or it will turn out invalid.
  • 0
    @CoreFusionX the objects are tiny (right now). I decided the "example" json file it produces has example strings that say "limit 2048". There is no limit, but creates a psychological prison. We will see how this fares. There is really no reason to put a lot of data in these fields. They are intended to be descriptions and cannot be used in the process at all.
Add Comment