Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9017035
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T04:09:39+00:00 2026-06-16T04:09:39+00:00

In my api i have a JSON output like this; { restaurants: [{ Restaurant:

  • 0

In my api i have a JSON output like this;

{
"restaurants": [{
    "Restaurant": {
        "id": "3",
        "name": "...",
        "slug": "...",
        "phone": "2161234567",
        "address": "...",
        "city_id": "34",
        "county_id": "426",
        "discount_type_id": null,
        "discount": "",
        "people_limit": "2",
        "reservations_required": false,
        "lat": "41.015608",
        "lon": "28.934834",
        "about": "...",
        "logo": "...",
        "logo_dir": "3",
        "photo_1": "...",
        "photo_2": null,
        "photo_3": null,
        "photo_dir": "3",
        "created": "2012-11-30 16:30:21",
        "modified": "2012-11-30 20:43:50",
        "deleted": true
    },
    "AvailabilityRestriction": [{
        "id": "1",
        "title": "...",
        "AvailabilityRestrictionRestaurant": {
            "id": "28",
            "restaurant_id": "3",
            "availability_restriction_id": "1"
        }
    }],
    "CuisineTag": [{
        "id": "3",
        "name": "...",
        "CuisineTagRestaurant": {
            "id": "47",
            "restaurant_id": "3",
            "cuisine_tag_id": "3"
        }
    }]
},

...
}

Restaurant has many cuisine_tags and availability restrictions. Also there’s a cities table… What’s the best way to sync them?

I have to sync cities, cuisine_tags and availability_restrictions first, then when creating restaurants i’ll match them? Is this the right way?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T04:09:40+00:00Added an answer on June 16, 2026 at 4:09 am

    I would do it like this….

    You should have all of the “Restaurant” properties (i.e. restirctions, cuisine-tags) within the restaurant object.

    Here’s an example:

    {
        "Restaurants" : [
            { 
                "id" : "3",
                "name" : "...",
                "slug" : "...",
                "phone" : "2161234567",
                "address" : "...",
                "city_id" : "34",
                "county_id" : "426",
                "discount_type_id" : null,
                "discount" : "",
                "people_limit" : "2",
                "reservations_required" : false,
                "lat" : "41.015608",
                "lon" : "28.934834",
                "about" : "...",
                "logo" : "...",
                "logo_dir" : "3",
                "photo_1" : "...",
                "photo_2" : null,
                "photo_3" : null,
                "photo_dir" : "3",
                "created" : "2012-11-30 16:30:21",
                "modified" : "2012-11-30 20:43:50",
                "deleted" : true,
                "AvailabilityRestrictions" : [
                    {
                        "id" : "1",
                        "title" : "..."
                    },
                    {
                        "id" : "2",
                        "title" : "..."
                    }
                ],
                "CuisineTags" : [
                    {
                        "id" : "3",
                        "name" : "..."
                    }
                ]
            }
        ]
    }
    

    Also get rid of the “Restaurant” object, it’s unneeded. If I have an array called Restaurants. I want to only put/get Restaurants in/from it.

    I think you had more to your question but I had trouble understanding what you need. Are you talking about how to set up relationships between them in Core Data?

    If you are looking to set relationships between cruisine tags and cities or whatever I think this is the best way to go because you can loop throught the JSON response and if one of the attributes is a list you can determine the list and fetch the correct managed object and create the relationship.

    Just to be clear, you should keep these cities, predefined cruise-tags in a different request though. You want to keep your API simple and flexible.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a RESTful API serving JSON. I'm calling it like this: - (void)viewDidLoad
I have an API Output like this: {user : {status : {stat1 : 54,
I have this http://localhost:3000/api/products request that returns json format output with a list of
My JSON output currently looks like this: description:MUSIC VIDEO - 7:13\n\nCREDITS\n\nLabel: Black Pain Records\nProduction
Basically, I have a JSON response from the Twitter API containing a timeline. I
I have the following json returned to me from an API. sections: { 1:
I am using google Api for custom search and have done the json Parsing.
I have a REST api which dumps some json data (user info, etc). Now
I have a web site with an API which publishes the information using JSON.
I have a web app with a clean RESTful JSON API, based on Rails

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.