HISE Logo Forum
    • Categories
    • Register
    • Login

    Basic JSON Question

    Scheduled Pinned Locked Moved General Questions
    7 Posts 5 Posters 109 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.
    • JulesVJ
      JulesV
      last edited by

      There is an external json file whose content is in the following format.

      {
          "Option 1": X,
          "Option 2": Y,
      }
      

      When I try to change the whole content of this external file to the following, I get a json error.

      What is my systematic mistake here?

      const var externalDat = 
      {
          "Option 1": A,
          "Option 2": B,
          "Option 3": C,
          "Option 4": D,
      };
      
      
      
      inline function CheckOnLoad()
      {
      	local data = Engine.loadFromJSON("../MyFile.dat");
      	
      	data = externalDat;
      				        
      	Engine.dumpAsJSON(data, "../MyFile.dat");
      			
      }
      
      A d.healeyD 2 Replies Last reply Reply Quote 0
      • A
        aaronventure @JulesV
        last edited by

        @JulesV maybe it's that last comma at the end of your last property, but I figured HISE was mostly resistant to that. Perhaps not on export?

        JulesVJ 1 Reply Last reply Reply Quote 0
        • d.healeyD
          d.healey @JulesV
          last edited by

          @JulesV said in Basic JSON Question:

          I get a json error.

          What's the error message?

          Libre Wave - Freedom respecting instruments and effects
          My Patreon - HISE tutorials
          YouTube Channel - Public HISE tutorials

          1 Reply Last reply Reply Quote 0
          • JulesVJ
            JulesV @aaronventure
            last edited by

            @aaronventure @d-healey

            The error is:

            Only objects can be exported as JSON
            

            Also tried data = trace(externalDat); still no luck.

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

              @JulesV whats X and Y?

              JulesVJ 1 Reply Last reply Reply Quote 0
              • JulesVJ
                JulesV @Christoph Hart
                last edited by

                @Christoph-Hart The variables I defined as const variables correspond to color codes in the script.

                const White = 0xFFFFFFFF;
                

                So the X is White in the real example.

                LindonL 1 Reply Last reply Reply Quote 0
                • LindonL
                  Lindon @JulesV
                  last edited by Lindon

                  @JulesV start here:

                  const var externalDat = 
                  {
                      "Option 1": A,
                      "Option 2": B,
                      "Option 3": C,
                      "Option 4": D
                  };
                  
                  
                  
                  inline function CheckOnLoad()
                  {
                  	local data = Engine.loadFromJSON("../MyFile.dat"););
                  	
                  	Console.print(trace(data));
                  	//data = externalDat;
                  				        
                  	//Engine.dumpAsJSON(data, "../MyFile.dat");
                  			
                  };
                  
                  CheckOnLoad();
                  

                  HISE Development for hire.
                  www.channelrobot.com

                  1 Reply Last reply Reply Quote 1
                  • First post
                    Last post

                  29

                  Online

                  1.7k

                  Users

                  11.8k

                  Topics

                  102.7k

                  Posts