Unclaimed Package Is this your package? Claim it to unlock full analytics and manage your listing.
Claim This Package

Install via UPM

Add to Unity Package Manager using this URL

https://www.pkglnk.dev/coryleach-simplejson.git

README Markdown

Copy this to your project's README.md

Style
Preview
pkglnk installs badge
## Installation

Add **SimpleJSON** to your Unity project via Package Manager:

1. Open **Window > Package Manager**
2. Click **+** > **Add package from git URL**
3. Enter:
```
https://www.pkglnk.dev/coryleach-simplejson.git
```

[![pkglnk](https://www.pkglnk.dev/badge/coryleach-simplejson.svg?style=pkglnk)](https://www.pkglnk.dev/pkg/coryleach-simplejson)

README

SimpleJSON šŸ‘‹

Version Twitter: coryleach

A C# json reader/writer which is Unity3D compatible based on http://wiki.unity3d.com/index.php/SimpleJSON
The official Github repo for this script can be found at https://github.com/Bunny83/SimpleJSON/blob/master/SimpleJSON.cs
Improvements from https://github.com/HenrikPoulsen/SimpleJSON
This repository is a fork that has been updated for direct import with the Unity PackageManager.

Quick Package Install

Using UnityPackageManager (for Unity 2019.3 or later)

Open the package manager window (menu: Window > Package Manager)
Select "Add package from git URL...", fill in the pop-up with the following link:
https://github.com/coryleach/SimpleJSON.git#1.0.0

Using UnityPackageManager (for Unity 2019.1 or later)

Find the manifest.json file in the Packages folder of your project and edit it to look like this:

{
  "dependencies": {
    "com.gameframe.simplejson": "https://github.com/coryleach/SimpleJSON.git#1.0.0",
    ...
  },
}

Usage

//From http://wiki.unity3d.com/index.php/SimpleJSON

var N = JSON.Parse(the_JSON_string);
var versionString = N["version"].Value;        // versionString will be a string containing "1.0"
var versionNumber = N["version"].AsFloat;      // versionNumber will be a float containing 1.0
var name = N["data"]["sampleArray"][2]["name"];// name will be a string containing "sub object"
 
//C#
string val = N["data"]["sampleArray"][0];      // val contains "string value"
 
//UnityScript
var val : String = N["data"]["sampleArray"][0];// val contains "string value"
 
var i = N["data"]["sampleArray"][1].AsInt;     // i will be an integer containing 5
N["data"]["sampleArray"][1].AsInt = i+6;       // the second value in sampleArray will contain "11"
 
N["additional"]["second"]["name"] = "FooBar";  // this will create a new object named "additional" in this object create another
                                               //object "second" in this object add a string variable "name"
 
var mCount = N["countries"]["germany"]["moronCount"].AsInt; // this will return 0 and create all the required objects and
                                                            // initialize "moronCount" with 0.
 
if (N["wrong"] != null)                        // this won't execute the if-statement since "wrong" doesn't exist
{}
if (N["wrong"].AsInt == 0)                     // this will execute the if-statement and in addition add the "wrong" value.
{}
 
N["data"]["sampleArray"][-1] = "Test";         // this will add another string to the end of the array
N["data"]["sampleArray"][-1]["name"] = "FooBar"; // this will add another object to the end of the array which contains a string named "name"
 
N["data"] = "erased";                          // this will replace the object stored in data with the string "erased"

Author

šŸ‘¤ Cory Leach

Show your support

Give a ā­ļø if this project helped you!


This README was generated with ā¤ļø by Gameframe.Packages

Comments

No comments yet. Be the first!