-3

I'm working for the first time with JSON. Please help me out. This is what my JSON looks like:

{
"metadata":[["15038",
        [["object_id",
                "15368"
            ],
            ["data_map",
                [["name",
                        "Sashimi"
                    ],
                    ["recipe_image",
                        "<?xml version=\"1.0\" encoding=\"utf-8\"?>\u000a<ezimage serial_number=\"1\" is_valid=\"1\" filename=\"Sashimi.jpg\" suffix=\"jpg\" basename=\"Sashimi\" dirpath=\"var/ezflow_site/storage/images/b2c/oppskrifter/norge/sashimi/166714-1-nor-NO\" url=\"var/ezflow_site/storage/images/b2c/oppskrifter/norge/sashimi/166714-1-nor-NO/Sashimi.jpg\" original_filename=\"Sashimi bredde.jpg\" mime_type=\"image/jpeg\" width=\"1200\" height=\"690\" alternative_text=\"Sashimi\" alias_key=\"1293033771\" timestamp=\"1291644679\"><original attribute_id=\"166714\" attribute_version=\"1\" attribute_language=\"nor-NO\"/><information Height=\"690\" Width=\"1200\" IsColor=\"1\" ByteOrderMotorola=\"0\" CCDWidth=\"35mm\" ApertureFNumber=\"f/8.0\" UserComment=\"\" UserCommentEncoding=\"UNDEFINED\" Thumbnail.FileType=\"2\" Thumbnail.MimeType=\"image/jpeg\"><serialized name=\"ifd0\" data=\"a:15:{s:10:&quot;ImageWidth&quot;;i:4368;s:11:&quot;ImageLength&quot;;i:2912;s:13:&quot;BitsPerSample&quot;;a:3:{i:0;i:8;i:1;i:8;i:2;i:8;}s:11:&quot;Compression&quot;;i:1;s:25:&quot;PhotometricInterpretation&quot;;i:2;s:4:&quot;Make&quot;;s:5:&quot;Canon&quot;;s:5:&quot;Model&quot;;s:12:&quot;Canon EOS 5D&quot;;s:11:&quot;Orientation&quot;;i:1;s:11:&quot;XResolution&quot;;s:4:&quot;72/1&quot;;s:11:&quot;YResolution&quot;;s:4:&quot;72/1&quot;;s:19:&quot;PlanarConfiguration&quot;;i:1;s:14:&quot;ResolutionUnit&quot;;i:2;s:8:&quot;Software&quot;;s:29:&quot;Adobe Photoshop CS4 Macintosh&quot;;s:8:&quot;DateTime&quot;;s:19:&quot;2010:01:13 20:36:26&quot;;s:16:&quot;Exif_IFD_Pointer&quot;;i:300;}\"/><array name=\"exif\"><item key=\"ExposureTime\" base64=\"1\">MS84</item><item key=\"FNumber\" base64=\"1\">OC8x</item><item key=\"ExposureProgram\" base64=\"1\">MQ==</item><item key=\"ISOSpeedRatings\" base64=\"1\">MjAw</item><item key=\"ExifVersion\" base64=\"1\">MDIyMQ==</item><item key=\"DateTimeOriginal\" base64=\"1\">MjAxMDowMToxMSAyMjo0MjozMw==</item><item key=\"DateTimeDigitized\" base64=\"1\">MjAxMDowMToxMSAyMjo0MjozMw==</item><item key=\"ComponentsConfiguration\" base64=\"1\">AQIDAA==</item><item key=\"ShutterSpeedValue\" base64=\"1\">MTk2NjA4LzY1NTM2</item><item key=\"ApertureValue\" base64=\"1\">MzkzMjE2LzY1NTM2</item><item key=\"ExposureBiasValue\" base64=\"1\">MC8x</item><item key=\"MeteringMode\" base64=\"1\">NQ==</item><item key=\"Flash\" base64=\"1\">MTY=</item><item key=\"FocalLength\" base64=\"1\">MTAwLzE=</item><item key=\"UserComment\" base64=\"1\">AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA</item><item key=\"FlashPixVersion\" base64=\"1\">MDEwMA==</item><item key=\"ColorSpace\" base64=\"1\">NjU1MzU=</item><item key=\"ExifImageWidth\" base64=\"1\">NDM2OA==</item><item key=\"ExifImageLength\" base64=\"1\">MjkxMg==</item><item key=\"FocalPlaneXResolution\" base64=\"1\">NDM2ODAwMC8xNDE1</item><item key=\"FocalPlaneYResolution\" base64=\"1\">MjkxMjAwMC85NDI=</item><item key=\"FocalPlaneResolutionUnit\" base64=\"1\">Mg==</item><item key=\"CustomRendered\" base64=\"1\">MA==</item><item key=\"ExposureMode\" base64=\"1\">MQ==</item><item key=\"WhiteBalance\" base64=\"1\">MA==</item><item key=\"SceneCaptureType\" base64=\"1\">MA==</item></array></information><alias name=\"small\" filename=\"Sashimi_small.jpg\" suffix=\"jpg\" dirpath=\"var/ezflow_site/storage/images/b2c/oppskrifter/norge/sashimi/166714-1-nor-NO\" url=\"var/ezflow_site/storage/images/b2c/oppskrifter/norge/sashimi/166714-1-nor-NO/Sashimi_small.jpg\" mime_type=\"image/jpeg\" width=\"293\" height=\"168\" alias_key=\"217385800\" timestamp=\"1323807975\" is_valid=\"1\"/><alias name=\"large\" filename=\"Sashimi_large.jpg\" suffix=\"jpg\" dirpath=\"var/ezflow_site/storage/images/b2c/oppskrifter/norge/sashimi/166714-1-nor-NO\" url=\"var/ezflow_site/storage/images/b2c/oppskrifter/norge/sashimi/166714-1-nor-NO/Sashimi_large.jpg\" mime_type=\"image/jpeg\" width=\"618\" height=\"355\" alias_key=\"2890659831\" timestamp=\"1319639601\" is_valid=\"1\"/><alias name=\"gallerywidethumbnail\" filename=\"Sashimi_gallerywidethumbnail.jpg\" suffix=\"jpg\" dirpath=\"var/ezflow_site/storage/images/b2c/oppskrifter/norge/sashimi/166714-1-nor-NO\" url=\"var/ezflow_site/storage/images/b2c/oppskrifter/norge/sashimi/166714-1-nor-NO/Sashimi_gallerywidethumbnail.jpg\" mime_type=\"image/jpeg\" width=\"150\" height=\"86\" alias_key=\"1571581304\" timestamp=\"1322682704\" is_valid=\"1\"/><alias name=\"gallerythumbnail\" filename=\"Sashimi_gallerythumbnail.jpg\" suffix=\"jpg\" dirpath=\"var/ezflow_site/storage/images/b2c/oppskrifter/norge/sashimi/166714-1-nor-NO\" url=\"var/ezflow_site/storage/images/b2c/oppskrifter/norge/sashimi/166714-1-nor-NO/Sashimi_gallerythumbnail.jpg\" mime_type=\"image/jpeg\" width=\"105\" height=\"60\" alias_key=\"27904634\" timestamp=\"1323764644\" is_valid=\"1\"/><alias name=\"max\" filename=\"Sashimi_max.jpg\" suffix=\"jpg\" dirpath=\"var/ezflow_site/storage/images/b2c/oppskrifter/norge/sashimi/166714-1-nor-NO\" url=\"var/ezflow_site/storage/images/b2c/oppskrifter/norge/sashimi/166714-1-nor-NO/Sashimi_max.jpg\" mime_type=\"image/jpeg\" width=\"943\" height=\"542\" alias_key=\"3797359156\" timestamp=\"1323706767\" is_valid=\"1\"/><alias name=\"imagelarge\" filename=\"Sashimi_imagelarge.jpg\" suffix=\"jpg\" dirpath=\"var/ezflow_site/storage/images/b2c/oppskrifter/norge/sashimi/166714-1-nor-NO\" url=\"var/ezflow_site/storage/images/b2c/oppskrifter/norge/sashimi/166714-1-nor-NO/Sashimi_imagelarge.jpg\" mime_type=\"image/jpeg\" width=\"550\" height=\"316\" alias_key=\"4054437477\" timestamp=\"1318593167\" is_valid=\"1\"/><alias name=\"medium\" filename=\"Sashimi_medium.jpg\" suffix=\"jpg\" dirpath=\"var/ezflow_site/storage/images/b2c/oppskrifter/norge/sashimi/166714-1-nor-NO\" url=\"var/ezflow_site/storage/images/b2c/oppskrifter/norge/sashimi/166714-1-nor-NO/Sashimi_medium.jpg\" mime_type=\"image/jpeg\" width=\"455\" height=\"261\" alias_key=\"169029957\" timestamp=\"1318593168\" is_valid=\"1\"/><alias name=\"articleimage\" filename=\"Sashimi_articleimage.jpg\" suffix=\"jpg\" dirpath=\"var/ezflow_site/storage/images/b2c/oppskrifter/norge/sashimi/166714-1-nor-NO\" url=\"var/ezflow_site/storage/images/b2c/oppskrifter/norge/sashimi/166714-1-nor-NO/Sashimi_articleimage.jpg\" mime_type=\"image/jpeg\" width=\"170\" height=\"97\" alias_key=\"2326327281\" timestamp=\"1318593168\" is_valid=\"1\"/><alias name=\"infoboximage\" filename=\"Sashimi_infoboximage.jpg\" suffix=\"jpg\" dirpath=\"var/ezflow_site/storage/images/b2c/oppskrifter/norge/sashimi/166714-1-nor-NO\" url=\"var/ezflow_site/storage/images/b2c/oppskrifter/norge/sashimi/166714-1-nor-NO/Sashimi_infoboximage.jpg\" mime_type=\"image/jpeg\" width=\"75\" height=\"43\" alias_key=\"2355174995\" timestamp=\"1318593168\" is_valid=\"1\"/></ezimage>\u000a"
                    ],
                    ["photographers_name",
                        "Synøve Dreyer"
                    ],
                    ["recipe_images",
                        "<?xml version=\"1.0\" encoding=\"utf-8\"?>\u000a<related-objects><relation-list/></related-objects>\u000a"
                    ],
                    ["recipe_images_chooser",
                        "https://market.seafood.no/SearchMediasForExternalApplication.do?globalSearchTerm=&validTo=12%2F01%2F2012&hookUrl=http://nor.eksportfis.prod.dedicated100.uk.webdeal.no/brandmakerphoto/photoupdater/15368/24/658&hookId=15368/24/658&destinationSize=1200x690&distort=no&imageEngine=true"
                    ],
                    ["show_on_front",
                        ""
                    ],
                    ["star_rating",
                        ""
                    ],
                    ["servings",
                        ""
                    ],
                    ["main_menu_categorization",
                        ", Gjester_Vennebesøk, Kampanje_Sushi, Kos_Helgekos, Hverdag_Sunn"
                    ],
                    ["categorization",
                        ", Vanskelighetsgrad_Middels, Type rett_Sushi og sashimi, Fisketype_Laks, Fisketype_Kveite, Fisketype_Kamskjell, Tilberedningstid_20 - 40 min"
                    ],
                    ["teaser",
                        "<?xml version=\"1.0\" encoding=\"utf-8\"?>\u000a<section xmlns:image=\"http://ez.no/namespaces/ezpublish3/image/\" xmlns:xhtml=\"http://ez.no/namespaces/ezpublish3/xhtml/\" xmlns:custom=\"http://ez.no/namespaces/ezpublish3/custom/\"><paragraph>I Japan serverer man gjerne ponzusaus til sashimi. Ingrediensene til en slik saus kan være vanskelig å få tak i her i Norge, så her foreslår vi to andre sauser som også passer godt til sashimi. &amp;nbsp;</paragraph></section>\u000a"
                    ],
                    ["ingredients",
                        "<?xml version=\"1.0\" encoding=\"utf-8\"?>\u000a<section xmlns:image=\"http://ez.no/namespaces/ezpublish3/image/\" xmlns:xhtml=\"http://ez.no/namespaces/ezpublish3/xhtml/\" xmlns:custom=\"http://ez.no/namespaces/ezpublish3/custom/\"/>\u000a"
                    ],
                    ["main_text",
                        "<?xml version=\"1.0\" encoding=\"utf-8\"?>\u000a<section xmlns:image=\"http://ez.no/namespaces/ezpublish3/image/\" xmlns:xhtml=\"http://ez.no/namespaces/ezpublish3/xhtml/\" xmlns:custom=\"http://ez.no/namespaces/ezpublish3/custom/\"><paragraph xmlns:tmp=\"http://ez.no/namespaces/ezpublish3/temporary/\"><ul><li><paragraph xmlns:tmp=\"http://ez.no/namespaces/ezpublish3/temporary/\">Her kan du velge om du vil lage en soyasaus med sesam og lime eller en sashimidressing. Du kan også bruke soyasaus hvis du ønsker det.</paragraph></li></ul></paragraph><section><section><section><header>Soyasaus med sesam og lime</header><paragraph xmlns:tmp=\"http://ez.no/namespaces/ezpublish3/temporary/\"><ul><li><paragraph xmlns:tmp=\"http://ez.no/namespaces/ezpublish3/temporary/\">Press saften av lime i soyasausen og rør inn sesamolje.</paragraph></li></ul></paragraph></section></section></section><section><section><section><header>Sashimidressing</header><paragraph xmlns:tmp=\"http://ez.no/namespaces/ezpublish3/temporary/\"><ul><li><paragraph xmlns:tmp=\"http://ez.no/namespaces/ezpublish3/temporary/\">Finhakk løk, sylteagurk, stangselleri, og kapers. </paragraph></li><li><paragraph xmlns:tmp=\"http://ez.no/namespaces/ezpublish3/temporary/\">Bland dette sammen med de øvrige ingrediensene, og la det stå å trekke litt i kjøleskapet. Mirin er en risvin med lavt alkoholinnhold som fås kjøpt i asiatiske forretninger.</paragraph></li></ul></paragraph></section></section></section><section><section><section><header>Sashimi</header><paragraph xmlns:tmp=\"http://ez.no/namespaces/ezpublish3/temporary/\"><ul><li><paragraph xmlns:tmp=\"http://ez.no/namespaces/ezpublish3/temporary/\">Skjær sjømaten i tynne skiver og anrett pent på et fat sammen.</paragraph></li><li><paragraph xmlns:tmp=\"http://ez.no/namespaces/ezpublish3/temporary/\">Server med soyasaus med sesam og lime eller sashimidressing, og gjerne tynne strimler av rettich og gulrot.</paragraph></li></ul></paragraph><paragraph><emphasize>Ønsker du å <strong>lære mer om sushi</strong> finner du nyttig informasjon <link target=\"_self\" url_id=\"858\">her. </link></emphasize></paragraph></section></section></section></section>\u000a"
                    ],
                    ["author",
                        "Norwegian Seafood Export Council"
                    ],
                    ["youtube_video",
                        "<?xml version=\"1.0\" encoding=\"utf-8\"?>\u000a<section xmlns:image=\"http://ez.no/namespaces/ezpublish3/image/\" xmlns:xhtml=\"http://ez.no/namespaces/ezpublish3/xhtml/\" xmlns:custom=\"http://ez.no/namespaces/ezpublish3/custom/\"><paragraph xmlns:tmp=\"http://ez.no/namespaces/ezpublish3/temporary/\"><literal class=\"html\">&lt;object width=\"618\" height=\"372\"&gt;&lt;param name=\"movie\" value=\"http://www.youtube.com/v/Y69-Ta0_Tfc?fs=1&amp;amp;hl=nb_NO&amp;amp;rel=0\"&gt;&lt;/param&gt;&lt;param name=\"allowFullScreen\" value=\"true\"&gt;&lt;/param&gt;&lt;param name=\"allowscriptaccess\" value=\"always\"&gt;&lt;/param&gt;&lt;embed src=\"http://www.youtube.com/v/Y69-Ta0_Tfc?fs=1&amp;amp;hl=nb_NO&amp;amp;rel=0\" type=\"application/x-shockwave-flash\" allowscriptaccess=\"always\" allowfullscreen=\"true\" width=\"618\" height=\"372\"&gt;&lt;/embed&gt;&lt;/object&gt;</literal></paragraph></section>\u000a"
                    ],
                    ["main_menu_categorization_selector",
                        "<?xml version=\"1.0\" encoding=\"utf-8\"?>\u000a<related-objects><relation-list><relation-item priority=\"1\" contentobject-id=\"11122\" contentobject-version=\"2\" node-id=\"10948\" parent-node-id=\"10947\" contentclass-id=\"49\" contentclass-identifier=\"tag\" contentobject-remote-id=\"9cc7b4ba9b47c94da56c269e86cb03c2\"/><relation-item priority=\"2\" contentobject-id=\"31635\" contentobject-version=\"1\" node-id=\"28570\" parent-node-id=\"16579\" contentclass-id=\"49\" contentclass-identifier=\"tag\" contentobject-remote-id=\"95517e870ac58cc8f70af70e2d798a89\"/><relation-item priority=\"3\" contentobject-id=\"220\" contentobject-version=\"5\" node-id=\"193\" parent-node-id=\"173\" contentclass-id=\"49\" contentclass-identifier=\"tag\" contentobject-remote-id=\"0b34aeb34a5ff3abe60d77c525fcd7d1\"/><relation-item priority=\"4\" contentobject-id=\"224\" contentobject-version=\"5\" node-id=\"197\" parent-node-id=\"174\" contentclass-id=\"49\" contentclass-identifier=\"tag\" contentobject-remote-id=\"8e5a6a212cbea6bf25d9180ecf77ffbb\"/></relation-list></related-objects>\u000a"
                    ],
                    ["categorization_selector",
                        "<?xml version=\"1.0\" encoding=\"utf-8\"?>\u000a<related-objects><relation-list><relation-item priority=\"1\" contentobject-id=\"104\" contentobject-version=\"20\" node-id=\"106\" parent-node-id=\"100\" contentclass-id=\"49\" contentclass-identifier=\"tag\" contentobject-remote-id=\"67dc83cb472f98c38f1de19611c47235\"/><relation-item priority=\"2\" contentobject-id=\"2488\" contentobject-version=\"7\" node-id=\"2465\" parent-node-id=\"260\" contentclass-id=\"49\" contentclass-identifier=\"tag\" contentobject-remote-id=\"f9c5ba8b49190839b20d5d0b97f12fa1\"/><relation-item priority=\"3\" contentobject-id=\"1623\" contentobject-version=\"9\" node-id=\"1600\" parent-node-id=\"98\" contentclass-id=\"49\" contentclass-identifier=\"tag\" contentobject-remote-id=\"verticalsite_18271\"/><relation-item priority=\"4\" contentobject-id=\"1632\" contentobject-version=\"7\" node-id=\"1609\" parent-node-id=\"98\" contentclass-id=\"49\" contentclass-identifier=\"tag\" contentobject-remote-id=\"verticalsite_18280\"/><relation-item priority=\"5\" contentobject-id=\"1641\" contentobject-version=\"7\" node-id=\"1618\" parent-node-id=\"98\" contentclass-id=\"49\" contentclass-identifier=\"tag\" contentobject-remote-id=\"verticalsite_18292\"/><relation-item priority=\"6\" contentobject-id=\"107\" contentobject-version=\"16\" node-id=\"109\" parent-node-id=\"99\" contentclass-id=\"49\" contentclass-identifier=\"tag\" contentobject-remote-id=\"11e07e691070c3a8cfcfc6a83402988c\"/></relation-list></related-objects>\u000a"
                    ],
                    ["ambassador_article",
                        "<?xml version=\"1.0\" encoding=\"utf-8\"?>\u000a<related-objects><relation-list/></related-objects>\u000a"
                    ],
                    ["comments",
                        ""
                    ],
                    ["seo_keywords",
                        ""
                    ],
                    ["meta_description",
                        ""
                    ],
                    ["publish_date",
                        ""
                    ],
                    ["unpublish_date",
                        ""
                    ],
                    ["manually_related_recipes",
                        null
                    ],
                    ["show_automatically_related_recipes",
                        null
                    ],
                    ["manually_related_articles",
                        null
                    ],
                    ["show_automatically_related_articles",
                        null
                    ]
                ]
            ]
        ]
    ]
]
}

Please let me know how I can get the name and recipe_image from above JSON. What I have searched so far are these links:

help me to parse JSON value using JSONTouch

http://www.iphonedevsdk.com/forum/iphone-sdk-development/81895-nested-json-nsdictionary-integer.html

How do I parse this nested JSON output in Objective C?

How to parse nested JSON objects with JSON framework and Objective-C/iPhone/Xcode?

How can I pull out nested JSON values in a collection in objective-C?

http://s316.codeinspot.com/q/2402326

6
  • This is strange behavior to nest XML in JSON data... Commented Dec 15, 2011 at 10:45
  • I know it it strange, but i got this xml from my client to read ,is there any way to read this ??? Commented Dec 15, 2011 at 10:52
  • You say you've read those links, but you havent said what you've actually tried to do, or what problems you have. Commented Dec 15, 2011 at 10:54
  • do you want xml content from json file?? Commented Dec 16, 2011 at 12:00
  • actually i want to get the values of name, recipe_image and caterisation_selector from above json, nut dont know how ... As m working first time on json.... Commented Dec 17, 2011 at 5:09

1 Answer 1

0

What I would suggest is using SBJson reader found on github https://github.com/stig/json-framework and then go find yourself a XML parser, Ray Wenderlich has great bench marking of the different XML parser out there for iOS

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

1 Comment

In IOS 5.0 Apple included the NSJSONSerialization class to convert JSON to Foundation objects and convert Foundation objects to JSON. Check out developer.apple.com/library/ios/#documentation/Foundation/… for the details

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.