Swift json some keys with quotes some some without

I am using get json data from the remote and using JSON (data) in swift with SwiftyJson, now the problem is what I am doing:

println(jsonObj.object)

I get the following:

{
    id = 3642;
    name = "Test";
    "front_image" = "/image/dasad.jpg";
    "is_new" = 0;
    price = "100";
}

I have a problem because some keys in this object are with double quotes, some without, so I cannot get the value with jsonObj.objectForKey("front_image")!.string

When I see the json url from the browser, this is what I get:

{
    "id" = 3642;
    "name" = "Test";
    "front_image" = "/image/dasad.jpg";
    "is_new" = 0;
    "price" = "100";
}

Is this a SwiftyJson error, or? What is the solution for this?

+4
source share
2 answers

Keys are ALWAYS strings, but quotation marks appear in the console when special characters are used that require escaping (for example, the underscore "_").

:

stackoverflow.com/questions/13836553/…: NSDictionary , - . println() . -

0

, , . - .

-2

All Articles