Easier way to serialize int value using JSONUtility ?

Hi, im looking for the easiest way to serialize a primitive value - in this case - a variable holding an int value.

According to JSON Serialization doc, the “easiest” way to do that is create a class/struct … wait what? For simple int variable? So i tried this and it works:

using System;

[Serializable]
public struct SerializableInt
{
    public int value;
}

and then elsewhere:

SerializableInt myInt = new SerializableInt();
myInt.value = 1;
Debug.Log (JsonUtility.ToJson(myInt)); // {"value":1}

but this looks as verbose as ever. Is there easier way to JSONize / StringIFY that?

Alternate approach not using JSON maybe?

My requirement is to pass string and parse it based on “dataType” something like:

switch (dataType) {
    case "int": // parse as if string contained ints only - using SerializableInt here currently
    case "float": // parse as if string contained float - SerializableFloat ???
    case "Array": // parse as if string contained array - SerializableArray ???
    case "Vector3": // fortunately we CAN parse the string using JSON directly.
    etc
}

JsonUtility doesn’t support direct serialisation of primitives yet. I’m hoping to add it around the same time as direct serialisation of arrays.