HISE Logo Forum
    • Categories
    • Register
    • Login

    json.length not working?

    Scheduled Pinned Locked Moved Solved Scripting
    3 Posts 2 Posters 98 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A
      aaronventure
      last edited by

      No such thing as the length property for JSON objects, like there is for arrays?

      Christoph HartC 1 Reply Last reply Reply Quote 0
      • Christoph HartC
        Christoph Hart @aaronventure
        last edited by

        @aaronventure nope, but you can iterate through the keys with for(key in jsonObject) if that's of any help.

        inline function getJSONLength(obj)
        {
            local i = 0;
            for(k in obj)
                i++;
            return i;
        }
        A 1 Reply Last reply Reply Quote 0
        • A
          aaronventure @Christoph Hart
          last edited by

          @Christoph-Hart yeah of course, I thought I hallucinated it for a second, probably because so many array methods work on objects, too. thanks.

          1 Reply Last reply Reply Quote 0
          • A aaronventure marked this topic as a question on
          • A aaronventure has marked this topic as solved on
          • First post
            Last post

          24

          Online

          1.7k

          Users

          11.8k

          Topics

          102.3k

          Posts