| Line | |
|---|
| 1 | using System;
|
|---|
| 2 | using System.Text;
|
|---|
| 3 |
|
|---|
| 4 | namespace AllocsFixes.JSON
|
|---|
| 5 | {
|
|---|
| 6 | public class JSONNull : JSONValue
|
|---|
| 7 | {
|
|---|
| 8 | public JSONNull ()
|
|---|
| 9 | {
|
|---|
| 10 | }
|
|---|
| 11 |
|
|---|
| 12 | public override void ToString (StringBuilder stringBuilder, bool prettyPrint = false, int currentLevel = 0)
|
|---|
| 13 | {
|
|---|
| 14 | stringBuilder.Append ("null");
|
|---|
| 15 | }
|
|---|
| 16 |
|
|---|
| 17 | public static JSONNull Parse (string json, ref int offset)
|
|---|
| 18 | {
|
|---|
| 19 | //Log.Out ("ParseNull enter (" + offset + ")");
|
|---|
| 20 |
|
|---|
| 21 | if (json.Substring (offset, 4).Equals ("null")) {
|
|---|
| 22 | //Log.Out ("JSON:Parsed Null");
|
|---|
| 23 | offset += 4;
|
|---|
| 24 | return new JSONNull ();
|
|---|
| 25 | } else {
|
|---|
| 26 | throw new MalformedJSONException ("No valid null value found");
|
|---|
| 27 | }
|
|---|
| 28 | }
|
|---|
| 29 |
|
|---|
| 30 | }
|
|---|
| 31 | }
|
|---|
| 32 |
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.