Vote count: 0 Hi I am trying to do a simple JSON string to Object conversion. Here is the code: let u = "somehost.com/api/1/ipa/2" let url = NSURL(string: u )! let data = NSData(contentsOfURL: url)! let parsed: AnyObject? = try NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions.AllowFragments) if let json = parsed as? [String: AnyObject]{ // parse json. } but it will not unwrap correctly. Seems to me that this should be much simpler. Could someone please help? Also using Xcode 7.3 and swift 2.2. I want to avoid using a third party library. asked 52 secs agoxazb Let's block ads!...
ادامه مطلبVote count: -1 I need to parse the line from the stream that would look like this: command "string1" "string2" string can contain spaces and escaped double-quotes. I need to split it so that I get command, string1 and string2 as array elements. I think split() with regex matching " but not " ( .split("(? ) would do the job, but I hear that that is not a good idea. What's the best way to do that in Java? asked 50 secs agouser1902247 Let's block ads!...
ادامه مطلبVote count: 0 I'm using express-xml-bodyparser in NodeJs and I have this in app.post("/fdsfdsfds", function (req, res, nxt) > req.body { my_obj: { var1: [ [Object] ] } } > req.body.my_obj { var1: [ { var2: [Object], var3: [Object], var1_code: [Object], email: [Object] } ] } > req.body.my_obj.var1 [ { var2: [ [Object] ], var3: [ 'fdsfdsfdsfds' ], var1_code: [ '14' ], var4: [ 'test2' ], useame: [ [Object] ], email: [ 'fdsfdsfds' ] } ] > req.body.my_obj.var1[0] { var2: [ { '$': [Object] } ], var3: [ 'fdsfdsfdsfds' ], var1_code: [ '14' ], var4: [ 'test2' ], useame: [ { '$': [Object] } ], email: [ 'fdsfdsfds' ] } I want to insert it into a db, therefore I have to create a dictionary. Is there any...
ادامه مطلب