2

I have a few values that I want give from Json

what I received from server:

(as you can see values aren't string)

 "HP": {
  "BaseValue": 44.0, //float
   "Point": 3.0, //float
   "UpdateFactor": 1.5 //float
   }

After receiving jason from server

IEnumerator ReceiveJson()
{
    var postScoreURL = Url;
    var postHeader = new Dictionary<string, string>();
    postHeader.Add("Content-Type", "application/json");
    WWW request = new WWW(postScoreURL, null, postHeader);
    yield return request;
    if (request.error != null)
    {
    }
    else
    {
        Receive = JSONNode.Parse(request.text);
        Debug.Log(Receive);
    }
}

why I received string value? (but here I have string values!!!)

 "HP": {
  "BaseValue": "44.0", //string
   "Point": "3.0", //string
   "UpdateFactor": "1.5" //string
   }
s.m.m
  • 105
  • 2
  • 9

1 Answers1

-3

Your json is invalid. You can check your json at Jsonlint.

Your json needs to look like this:

{
    "HP": {
        "BaseValue": 44.0,
        "Point": 3.0,
        "UpdateFactor": 1.5
    }
}
Palle Due
  • 5,929
  • 4
  • 17
  • 32