FAQ Database Discussion Community


Populating Custom TableViewCell from Twitter using JSON Serialization

objective-c,uitableview,nsdictionary,tableview,nsjsonserialization
I am new to Objective-C. I spent countless hours being stuck on getting a blank tableview, I am desperate at this point. I am loading twitter data through a JSON call, using their API. I store everything in a NSDictionary, run a for loop to select only "text" values. I...

Newtonsoft inline formatting for subelement while serializing

c#,json.net,nsjsonserialization
Is it possible to create an attribute to serialize some subelements inline (Formatting.None) with newtonsoft json.net? I have a very huge set of data and I want to keep it readeable. Some subelements are not very important and can be writen inline. { "name": "xxx", "desc": "xxx", "subelem": [ {"val1":...

How to write JSON mixed mode data?

json,swift,nsjsonserialization
I want to write a combination of dictionary and data array. My data looks like this The function I use is func writeJSONdata() { var error: NSError? var filename:String = "testWrite.json" var dict:NSMutableDictionary = ["3Dmodel":"Model_Student_v3", "3Ddata":"testdata file", "3DColors":"color file name"] var myArray:[Float] = [1.0,-0.13131,12.0] let dirPaths = NSSearchPathForDirectoriesInDomains( NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomainMask.UserDomainMask,...

serializing a json file from list of list

python,json,nsjsonserialization,jsonserializer
So i have a list of elements: elements = [room1, room2, room3] I also have a list of key/value attributes that each room has: keys = ["level", "finish1", "finish2"] values = [["ground", "paint1", "carpet1"],["ground", "paint1", "paint2"], ["second level", "paint1", "paint2"]] is there a way to serialize this two lists into...

Can I serialize negative integer by NSJSONSerialization?

ios,nsnumber,nsjsonserialization
I can't serialize negative integer by NSJSONSerialization. Objective-C : NSMutableDictionary *sendData = [NSMutableDictionary dictionaryWithObjectsAndKeys: @480, @"width", @800, @"height" @-10, @"value1", @10, @"value2", nil]; NSError *error = nil; NSData *dataJSon = [NSJSONSerialization dataWithJSONObject:sendData options:0 error:&error]; NSLog(@"sendData\n %@ \n\n", [sendData description]); Log sendData{ width = 480; // int height = 800; //...

Getting error in JSON parsing with array in iOS

ios,json,parsing,nsjsonserialization
I am newly to iPhone, basically in my application I am parsing below JSON model and need to save it in my custom Entity class. JSON model : { "Products": [ { "Pcs": [ { "product_id": 2, "product_name": "MyProduct", "category": { "Clamshells": [ { "product_category_id": 11, "product_category_name": "MyProductCategory", "Sub_category": [...

How to convert a JSON string to a dictionary?

json,swift,dictionary,nsjsonserialization
I want to make one function in my swift project that convert String to Dictionary json format but I got one error: Cannot convert experssion's type (@lvalue NSData,options:IntegerLitralConvertible ... This is my code: func convertStringToDictionary (text:String) -> Dictionary<String,String> { var data :NSData = text.dataUsingEncoding(NSUTF8StringEncoding)! var json :Dictionary = NSJSONSerialization.JSONObjectWithData(data, options:0,...