JSONItem replacement

  1. ‹ Older
  2. 3 years ago

    Kem T

    1 May 2016 Pre-Release Testers, Xojo Pro, XDC Speakers New York
    Edited 3 years ago

    I just released v.3.0 of JSONItem_MTC , the drop in replacement for the classic framework JSONItem.

    This version does a few things. First, I did away with the pragmas to disable background tasks and checks. Why? First, it didn't make much difference in speed anyway. Second, it would tie things up when encoding large JSON.

    Second, I made memory usage more efficient when turning the JSON into a string. Rather than using one ever-expanding MemoryBlock, it creates a series of MemoryBlocks to hold the output and joins them at the end. As such, it can serialize a 500 MB JSON without issue. (Larger strings will give Xojo fits, it seems.)

    I also added a few more tests to the harness project.

    If you're using JSONItem, I encourage you to consider this instead. JSONItem has a few issues that have been solved by this class, as illustrated by the included unit tests. (See the README for some of the details.) And it's faster to boot.

    Edit: Oh yeah, I also added an Operator_Subscript so you can both assign and retrieve values from an Array-type JSON with a simple index. For example:

    dim j as new JSONItem_MTC( "[1, 2]" )
    
    dim i as integer = j( 0 )
    j( 1 ) = true
  3. Jim S

    1 May 2016 Pre-Release Testers, Xojo Pro Columbia, South Carolina, USA

    @Kem T If you're using JSONItem, I encourage you to consider this instead.

    In checking a few of my apps I found one that uses your Kaju (which I appreciate very much.) It has 18 places where "JSONitem" is used, 17 are within the Kaju class.

    Should I change all 18 to use "JSONitem_MTC?

    Thanks again you and Luke and Jeremy Cowger for KAJU.

  4. Kem T

    1 May 2016 Pre-Release Testers, Xojo Pro, XDC Speakers New York

    The JSON in Kaju is well controlled and fairly small, and speed is not a big issue, which is why I didn't use it there. I'd leave that alone.

  5. 8 months ago

    Kem T

    12 Sep 2018 Pre-Release Testers, Xojo Pro, XDC Speakers New York

    I just released JSONItem_MTC v.4.0. While there have been no functional changes to that class, the project now includes M_JSON, and that includes ParseJSON_MTC and GenerateJSON_MTC. As you might guess, those do what the new framework Xojo.Data. functions do, but with the classic (soon to be API 2.0) framework. In other words, rather than working with Text, Xojo.Core.Dictionary, and Auto(), they work with String, Dictionary, and Variant().

    GenerateJSON_MTC also has an optional parameter to produce "pretty" output.

    As always, the project can be found at:

    https://github.com/ktekinay/JSONItem_MTC

  6. 4 months ago

    Kem T

    Jan 23 Pre-Release Testers, Xojo Pro, XDC Speakers New York

    The JSONItem_MTC project has been update to 4.1. This is a minor change that only affects debugging. When the keys of JSON objects are stored internally, they used to be converted to/from hex to preserve case-sensitivity. Now they are stored in the form key-HEX.

  7. 3 months ago

    Tim S

    Feb 14 Pre-Release Testers, Xojo Pro Phoenix Arizona USA

    This is really fantastic Kem! I had the same problem and you solved it!
    Thank you for sharing your hard work!

    Tim

or Sign Up to reply!