8

I'm using SimpleJSON, and I am kinda new to json.

For some reason, no one on google mentions how to convert objects to json strings. They just all say deserialize json strings, or give you an already made json string. Even SimpleJSON's documentary doesn't mention it. Why is that?

This is my code. Does anyone know what is the code to convert stuff to a json string?

[System.Serializable]
public class Skill
{
    public bool crush = false;
    public bool parry = false;
    public bool slam = false;
    public bool magic = false;
    public bool evadeUp = false; 
}

public Skill[] allSkills;

1 Answer 1

3

Using Newtonking's JSON parser you can drag the dll into your Plugins folder and reference it (using Newtonsoft;) from there, it's one of the best serialisers I've seen online, I highly recommend using it:

http://james.newtonking.com/json

Sign up to request clarification or add additional context in comments.

6 Comments

Hey! thanks for the answer! Sorry, one last dumb question. How do I reference?
Just add using Newtonsoft; to code files that need it - easy as that. You can find the API reference on the same page I linked.
Not a problem, have a good look through the API ref and examples. It's pretty easy to use and has all .Net versions available too so upgrading is a pinch.
Is this really compatible with Unity/iOS?
Can confirm does not work with iOS or WebPlayer. Does work on Editor Player and standalone builds (only the NET20 dll seemed to work).
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.