JSONItem replacement

  1. ‹ Older
  2. 8 months ago

    Kem T

    7 Aug 2019 Pre-Release Testers, Xojo Pro, XDC Speakers, MVP Connecticut
    Edited 8 months ago

    I've updated the project to 4.1.1. It turns out that M_JSON was not encoding embedded quotes or backslashes, a mistake so embarrassing that I wish @Thom M had caused it instead of merely reporting it. Alas, I am left with nobody else to blame, and hope it didn't cause any headaches.

    Again, the project is at:

    https://github.com/ktekinay/JSONItem_MTC

  3. 4 weeks ago

    Jürg O

    Mar 3 Pre-Release Testers, Xojo Pro
    Edited 4 weeks ago

    @Kem T JSONItem_MTC , the drop in replacement for the classic framework JSONItem
    If you're using JSONItem, I encourage you to consider this instead.

    I've been using JSONItem_MTC in a project, and noticed the speed improvement. So thanks a lot!

    In another project it seems I have run into a limitation, which doesn't make JSONItem_MTC a "drop in replacement" ;)
    It seems that JSONItem_MTC can't handle Array-Values :(
    Here is an example project showing the issue/difference.

    This works as expected with JSONItem:

    Dim oJSON As New JSONItem
    oJSON.Value("field") = "a_fieldname"
    oJSON.Value("operator") = "IN"
    oJSON.Value("values") = Array(12, 15, 20)

    JSONItem_MTC however raises a JSONException( "Illegal Value", 10 ).
    One could modify it's .Validate to cope with Arrays (get the DataType of the Array-element-type -> TypeArray is logically OR'ed with the element type):

    Dim iCheckVariantType As Integer = Bitwise.BitAnd(value.type, Bitwise.OnesComplement(Variant.TypeArray))
    select case iCheckVariantType

    But then .Serialize -> .EncodeValue will fail.

    That's why I've stopped trying the do further modifications... at least before asking if you intend JSONItem_MTC to handle Array-values sooner or later?

  4. Kem T

    Mar 3 Pre-Release Testers, Xojo Pro, XDC Speakers, MVP Connecticut
    Edited 4 weeks ago

    Picky, picky, picky...

    Please pull the latest develop branch of the project. It includes unit tests to show what works for JSONItem_MTC now, and what does and doesn't work with JSONItem.

    https://github.com/ktekinay/JSONItem_MTC

    Edit: Bolded the word "develop".

  5. Kem T

    Mar 3 Pre-Release Testers, Xojo Pro, XDC Speakers, MVP Connecticut

    I just ran this against my develop branch without issue. What am I missing?

  6. Tim P

    Mar 3 Pre-Release Testers, Xojo Pro Rochester, NY

    Be sure you're on the develop branch as Kem mentioned.
    https://github.com/ktekinay/JSONItem_MTC/branches

  7. Kem T

    Mar 3 Pre-Release Testers, Xojo Pro, XDC Speakers, MVP Connecticut

    Norman's deleted post contained code that doesn't work on the current release version, but does work on the develop branch that contains that fix. I'll release it as soon as I am comfortable that it now works correctly and matches (or, in this case, exceeds) the native version.

  8. Jürg O

    Mar 3 Pre-Release Testers, Xojo Pro

    @Kem T Please pull the latest develop branch of the project.

    I'll do that in the next couple of days.
    I haven't even thought about looking into the other branches beforehand... but it seems that you've checked in a fix after my last post and not have done that work long ago with me not finding it (by not looking into the dev-branch).

    @Kem T Picky, picky, picky...

    Yeah - sorry about that :)
    It might have been worth being picky, if that has helped to improve JSONItem_MTC even more. ;)

    Anyway - thanks a lot for the fix! I'll see how it works for this project when I get back to it.

  9. Kem T

    Mar 3 Pre-Release Testers, Xojo Pro, XDC Speakers, MVP Connecticut

    Maybe I should have put a :) after "picky, picky, picky". Text doesn't always get the meaning across.

    The current fix was entirely due to your post, in case that wasn't clear.

  10. Jürg O

    Mar 3 Pre-Release Testers, Xojo Pro
    Edited 4 weeks ago

    @Kem T The current fix was entirely due to your post, in case that wasn't clear.

    Not when I've only read that one first ;)
    Ah... now I see, that's related to a deleted post.

    At least I have put a couple of ;) after quoting your 3x picky - I think it has been clear enough :)
    Thanks again...!

  11. Kem T

    Mar 3 Pre-Release Testers, Xojo Pro, XDC Speakers, MVP Connecticut

    Yeah, unfortunately Norman deleted his post so the responses are now out of context. That was in response to code he posted that he claimed still didn't work, but I'm pretty sure he tried it against the release (master branch) instead of the just-fixed develop branch.

    Anyway, let me know what you find. Since this class has been out literally for years without anyone noticing, I guess I can wait another few days to make sure the fix is right. :)

  12. Norman P

    Mar 3 Pre-Release Testers, Xojo Pro outside enjoying the fresh air

    I removed my comment based on the complaint I received about the impression it might have left readers with

  13. Jürg O

    Mar 4 Pre-Release Testers, Xojo Pro

    @Kem Tekinay this class has been out literally for years without anyone noticing

    Someone is always the first one... Even though I can hardly believe no one seems to have been using Array-values.

    @Kem T Anyway, let me know what you find.

    So far it now works as a "drop in replacement" ;)
    And should this project uncover other picky issues, I'll let you know. So far - all good. Thanks!

  14. Kem T

    Mar 4 Pre-Release Testers, Xojo Pro, XDC Speakers, MVP Connecticut

    It's not that nobody was using array values, it's probably that they, like me, were creating a new instance to hold the array.

  15. Jürg O

    Mar 4 Pre-Release Testers, Xojo Pro

    @Kem T It's not that nobody was using array values, it's probably that they, like me, were creating a new instance to hold the array.

    Ah right - I've taken a shortcut then ;)

    Picky again...?
    There's a typo here: raise new JSONException( "This JSONItem_MTC is an obect", 13 )
    And another one in the release notes of the Dev-Branch: JSONItem_MTC will roperly deal with assignments of arrays.

  16. Kem T

    Mar 4 Pre-Release Testers, Xojo Pro, XDC Speakers, MVP Connecticut

    Fixed, thanks.

  17. 2 weeks ago

    Kem T

    Mar 21 Pre-Release Testers, Xojo Pro, XDC Speakers, MVP Connecticut

    I've released JSONItem_MTC v.4.2:

    • ParseJSON will take an optional parameter to make the result case-INsensitive (regular Dictionary).
    • JSONItem_MTC will properly deal with assignments of arrays.
    • JSONItem_MTC will auto-convert to Dictionary and Variant().
    • JSONItem_MTC implements compare against other JSONItem_MTC.
    • JSONWebToken_MTC no longer depends on JSONItem_MTC.
    • JSONWebToken_MTC has various fixes and no longer depends on JSONItem_MTC.

    https://github.com/ktekinay/JSONItem_MTC

  18. brian f

    Mar 21 Pre-Release Testers, Xojo Pro Chilly California

    @Kem T I've released JSONItem_MTC v.4.2:

    • ParseJSON will take an optional parameter to make the result case-INsensitive (regular Dictionary).
    • JSONItem_MTC will properly deal with assignments of arrays.
    • JSONItem_MTC will auto-convert to Dictionary and Variant().
    • JSONItem_MTC implements compare against other JSONItem_MTC.
    • JSONWebToken_MTC no longer depends on JSONItem_MTC.
    • JSONWebToken_MTC has various fixes and no longer depends on JSONItem_MTC.

    https://github.com/ktekinay/JSONItem_MTC

    Do you ever sleep? :P

  19. Kem T

    Mar 22 Pre-Release Testers, Xojo Pro, XDC Speakers, MVP Connecticut

    @Kem T JSONItem_MTC implements compare against other JSONItem_MTC.

    To clarify, this code now works:

    var j1 as new JSONItem_MTC( "{ ""a"": 1, ""b"": 2 }" )
    var j2 as new JSONItem_MTC( "{ ""b"": 2, ""a"": 1 }" )
    if j1 = j2 then
      // it does
    end if

or Sign Up to reply!