JSON question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • wmgilligan
    Developer Partner




    • Feb 2006
    • 742

    #1

    JSON question

    I am trying a basic json call to another server we have .
    I create the json, post or raw it via mvcall, and I get the response I have hard coded on the receiving end "hello".
    BUT - I do not get s.content_data, or arg2, etc. (the json I sent over).
    Any suggestions on getting the receiving page to read the json and display it?
    William Gilligan - Orange Marmalade, Inc.
    www.OrangeMarmaladeinc.com
  • dcarver
    Director of Software Dev.




    • May 2013
    • 400

    #2
    You are sending data from one .mvc file to another .mvc file? s.content_data should be populated for the file on the other end of the MvCALL. You should post a snippet of the MvCALL code you are doing along with a snippet from the other file where you are receiving the data.
    David Carver
    Miva, Inc. | Software Developer

    Comment

    • wmgilligan
      Developer Partner




      • Feb 2006
      • 742

      #3
      SENDING FILE:
      Code:
      <MvAssign name="info" value="{ '
      {
      "fromZip":32084,
      "toZip": 16901,
      "weight": 2.0,
      "length": 6.0,
      "width": 5.0,
      "height": 3.0,
      "type": "RETAIL",
      "mailingDate": "09-25-2025"
      }'
      }">
      
      
      <MvCall ACTION="https://www.XXXXXXXX.co/utilities/getXXXXX.mvc?" METHOD="raw" HEADERS="" CONTENT-TYPE="application/json" FLAGS="noparse" FIELDS="info">
      <MvEval expr="{ callvalue }">
      </MvCall>
      RECEIVING FILE:
      Code:
      hello
      <MvAssign name="l.ok" value="{ miva_json_decode(s.content_data, respOut) }">
      <MvEval expr="{ arg2 $ s.content_data $ info }">
      RESULT:
      hello
      William Gilligan - Orange Marmalade, Inc.
      www.OrangeMarmaladeinc.com

      Comment

      • dcarver
        Director of Software Dev.




        • May 2013
        • 400

        #4
        I would expect it to show up in that case. Also since you are specifying a Content-Type of application/json, s.json_data would already have the decoded value available for you to use. However, I doubt that is there if s.content_data is not present.
        David Carver
        Miva, Inc. | Software Developer

        Comment

        • wmgilligan
          Developer Partner




          • Feb 2006
          • 742

          #5
          Not sure what happenedd, but it suddenly started working - cache maybe?

          Either way - thanks
          William Gilligan - Orange Marmalade, Inc.
          www.OrangeMarmaladeinc.com

          Comment

          Working...
          X