playMaker

Author Topic: Help with Strings [SOLVED]  (Read 1307 times)

Hudfire

  • Playmaker Newbie
  • *
  • Posts: 6
Help with Strings [SOLVED]
« on: October 23, 2015, 06:29:46 PM »
I am creating an app for Android and hopefully for iOS as well where I am using Unity to send commands to a Particle Photon device. I can send the commands to it by using the WWWPOST Mobile action. It works great and is doing what I need it to do. However, I am having a problem with trying to figure out how to parse information from a returned string.

The following string is returned after sending the command:

{
  "id": "xxxxxxxxxxxxxxxxxxxxxxxxx",
  "last_app": "",
  "connected": true,
  "return_value": 1
}

My question is, how would I pull the information for the "return_value": and save it to a variable? In the above example, I would need to save the '1' as an int variable. That number changes depending on which command I send, and would like to be able to check what state the device is in.

Any help on this issue would be greatly appreciated.

Thanks!
Dave
« Last Edit: October 30, 2015, 08:32:17 PM by Hudfire »

Hudfire

  • Playmaker Newbie
  • *
  • Posts: 6
Re: Help with Strings
« Reply #1 on: October 28, 2015, 10:29:53 AM »
Bump!

Still banging my head against my desk  ;)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15501
  • Official Playmaker Support
Re: Help with Strings
« Reply #2 on: October 28, 2015, 11:27:27 AM »
Hi,

 this is a json string, and so you should use some custom actions for this.

I have created a framework that handles Xml and json, called DataMaker.

There is an action called "JsonGetObjectProperties" which will save properties of a single json object in fsm variables.

Bye,

 Jean

Hudfire

  • Playmaker Newbie
  • *
  • Posts: 6
Re: Help with Strings
« Reply #3 on: October 28, 2015, 07:35:28 PM »
Thank you very much for this Jean. I will look into it and let you know how it works out.

Hudfire

  • Playmaker Newbie
  • *
  • Posts: 6
Re: Help with Strings
« Reply #4 on: October 28, 2015, 07:45:24 PM »
Jean, you rock brother!!! This works perfectly. Thank you so much!