Reputation: 421
{"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
Upvotes: 0
Views: 653
Reputation: 1074555
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:
"Street":
."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.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.
Upvotes: 1