0
{"Street": [ { "Street_name":"Dewlane Dr", "Street_numbers": [ { "number":26, "Unit_number":"" } ] } ] } 

but i get this error while parsing it on iPhone thorough SBJSON.

Error Domain=org.brautaset.JSON.ErrorDomain Code=3 \"Object value expected for key: Street\" UserInfo=0x595fd60 {NSUnderlyingError=0x593cfc0 
5
  • Sorry Naveed i didn't get you Commented Jun 6, 2011 at 18:09
  • 1
    Is there going to be an array of streets?.. the [] are unnecessary in this example and may be causing your issue. Commented Jun 6, 2011 at 18:10
  • 6
    @user671247 You've only accepted answers on 29% of the questions you've asked. This is frowned upon as you haven't been giving reputation gains to those who have helped you. Commented Jun 6, 2011 at 18:11
  • actually i will extracting them all in arrays as they will have many records, i mean array for Street, Street_name and street_number Commented Jun 6, 2011 at 18:14
  • @user: "i mean array for Street, Street_name and street_number" Well, two of those are arrays. Right now, Street_name's value is just a string. Commented Jun 6, 2011 at 18:16

1 Answer 1

1

There's an extra closing quote after "Unit_number". Ah, that was just a copy-and-paste error.

There's nothing wrong with it, as far as I can see and according to jsonlint.com.

Just to break it down: Your structure has one outermost object, which has a Street property. The Street property's value is an array with one entry. That one entry is an object with the properties Street_name, which has a string value, and Street_numbers, which has an array value. The one entry in the Street_numbers array is an object with two properties, number and Unit_number.


Update: I never addressed the SBJSON error.

If you're getting that error from SBJSON, it suggests one of the following:

  1. What you're feeding into SBJSON isn't what you've quoted (it's quite an easy mistake to make). For instance, perhaps what you're feeding in has gotten truncated in some way just after "Street":.
  2. You have a character after "Street": looks like whitespace by the time you've pasted it into StackOverflow, but isn't whitespace by the usual definitions, and so SBJSON thinks it's a character that should be processed and is choking on it.
  3. SBJSON has a bug in it related to the value being on the line following the colon (which seems unlikely).
  4. SBJSON has a bug related to the precise kind of whitespace you have at that location. There are lots of different whitespace charactesrs in Unicode, if you've (probably inadvertently) used an unusual one, SBJSON may not be handling it correctly.

But if what looks like whitespace in what you posted is comprised entirely of carriage returns, spaces, tabs, line feeds, and other classic whitespace, and if the string you're passing to SBJSON's deserializer is what you've posted, it's a problem with SBJSON.

Sign up to request clarification or add additional context in comments.

1 Comment

actually that was my mistake when i paste it here, i fixed it but still not working

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.