playMaker

Author Topic: Parse JSON  (Read 6954 times)

ssk9208

  • Playmaker Newbie
  • *
  • Posts: 16
Parse JSON
« on: January 09, 2015, 04:36:20 AM »
Hi,

Can anyone create an action that gets a Json object from a URL and stores the data it contains to strings?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Parse JSON
« Reply #1 on: January 09, 2015, 06:01:16 AM »
Hi,

 I have this planned, but the major problem with json is then accessing data in a convenient way because json libraries do not have the Xpath equivalent search system that is found with Xml, so accessing data is tricky with json within PlayMaker.

What I think would work well is to get the json and convert it into xml, which then is all accessed using XmlMaker. I already have a converted in place, but it's still very much a work in progress.

If you think it would be useful for you, let me know, and I can clean this up and start sharing it properly on the wiki.


 Bye,

 Jean

ssk9208

  • Playmaker Newbie
  • *
  • Posts: 16
Re: Parse JSON
« Reply #2 on: January 09, 2015, 06:17:05 AM »
Thanks for the prompt reply!

It will be very useful for me, since I am building a license verification system in my site. I submit the url with the license key in it and the site will send a Json object with info about the license.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Parse JSON
« Reply #3 on: January 09, 2015, 06:51:14 AM »
Hi,

 ok, please bump every beginning of the week or so, I have too many things to do, so bumping is required at the present time :)

 Bye,

 Jean

ssk9208

  • Playmaker Newbie
  • *
  • Posts: 16
Re: Parse JSON
« Reply #4 on: January 12, 2015, 06:33:05 AM »
bump  8)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Parse JSON
« Reply #5 on: January 13, 2015, 07:43:12 AM »
Hi,

Thanks for bumping :)

 It went quicker then expected, even tho it will depend on a third party json library ( newtonsoft, so it's solid, but I whish I could have just used .net).

 Check this attached package. Let me know if it's ok ( there is an example in "PlayMaker DataMaker/json/examples" that takes a json string, parse it into xml, you can verify the content in the xml proxy.

 Let me know how it goes.

 A lost more can be done to just work with json, sometime it may be just enough, but as far as converting directly to xml, you are all set.

 Bye,

 Jean

ssk9208

  • Playmaker Newbie
  • *
  • Posts: 16
Re: Parse JSON
« Reply #6 on: January 15, 2015, 07:03:41 AM »
Assets/PlayMaker DataMaker/Json/Actions/ConvertJsonStringToXmlNode.cs(16,51): error CS0246: The type or namespace name `DataMakerXmlNodeActions' could not be found. Are you missing a using directive or an assembly reference?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Parse JSON
« Reply #7 on: January 15, 2015, 02:08:25 PM »
Hi,

 You do need the XmlMaker to be installed as well.

 also, quick note: if you have Photon for example, you will have a Newtonsoft.Json library as a duplicate, simply delete the duplicates in your projects to leave only one.

Bye,

 Jean

akkiDev

  • Playmaker Newbie
  • *
  • Posts: 4
Re: Parse JSON
« Reply #8 on: October 06, 2015, 03:48:36 AM »
How to install XmlMaker ... ????

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Parse JSON
« Reply #9 on: October 14, 2015, 07:10:16 AM »
Hi,

 It's shipped under DataMaker, sorry for the confusion :)

 Bye,

 Jean