Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to create a json file in iOS?
    primarykey
    data
    text
    <p>I have some data and need to create a json file with this structure :</p> <pre><code>{"eventData":{"eventDate":"Jun 13, 2012 12:00:00 AM","eventLocation":{"latitude":43.93838383,"longitude":-3.46},"text":"hjhj","imageData":"raw data","imageFormat":"JPEG","expirationTime":1339538400000},"type":"ELDIARIOMONTANES","title":"accIDENTE"} </code></pre> <p>Can Please someone give me some code how to to put my data in a json file with this structure or at least an example on how u make json structures? </p> <p>EDIT</p> <p>Ok so i wrote some code :</p> <pre><code>NSString *jsonString = @"[{\"eventData\":{\"eventDate\":\"Jun 13, 2012 12:00:00 AM\",\"eventLocation\":{\"latitude\":43.93838383,\"longitude\":-3.46},\"text\":\"hjhj\",\"imageData\":\"raw data\",\"imageFormat\":\"JPEG\",\"expirationTime\":1339538400000},\"type\":\"ELDIARIOMONTANES\",\"title\":\"accIDENTE\"}]"; NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding]; NSError *e; NSMutableArray *jsonList = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableContainers error:&amp;e]; NSLog(@"jsonList: %@", jsonList); </code></pre> <p>jsonList is a json file now ??? And is it in the correct format?? Cause when i print it the output is : </p> <pre><code>jsonList: ( { eventData = { eventDate = "Jun 13, 2012 12:00:00 AM"; eventLocation = { latitude = "43.93838383"; longitude = "-3.46"; }; expirationTime = 1339538400000; imageData = "raw data"; imageFormat = JPEG; text = hjhj; }; title = accIDENTE; type = ELDIARIOMONTANES; } ) </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload