HISE Logo Forum
    • Categories
    • Register
    • Login

    JSON Server response

    Scheduled Pinned Locked Moved Scripting
    3 Posts 2 Posters 249 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.
    • I
      IsoWalle
      last edited by

      Hi!
      Maybe this is a really stupid question but yet I'm asking it.

      I use callwithPOST to a server an expect an answer like "OK".
      I get this though as a JSON object. How do i use this in the rest of the script?

      I would like it to work as a verification.
      If response = "OK", Then something happens.

      I feel like this probably is a really easy thing to do, but if someone could help me I would be very grateful.

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

        @isowalle

        so (as you know) the callWithPOST format is:

        Server.callWithPOST(String subURL, var parameters, var callback)
        

        e.g.

        Server.callWithPOST(tempURL, p, function(status, response){
        
        
        });
        

        response is a JSON object so you can reference any of the values in the response like any other JSON object

        local myAnswer = response.<some value name>;
        

        eg: assuming your JSON has a value called msg

        Server.callWithPOST(tempURL, p, function(status, response){
            reg myAnswer = response.msg;
        });
        

        HISE Development for hire.
        www.channelrobot.com

        I 1 Reply Last reply Reply Quote 0
        • I
          IsoWalle @Lindon
          last edited by

          @lindon Thaaaaank you!!

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

          44

          Online

          1.7k

          Users

          11.7k

          Topics

          101.8k

          Posts