0

Hi I have the following JSON

{
    id: 35,
    chain_id: 32,
    name: "HAPS",
    phone: "33330210",
    url: null,
    contact: null,
    user_id: null,
    uuid: null,
    lat: 55.682044,
    lng: 12.572165,
    before_closing_time: 15,
    slug: "haps",
    img_url: {
        img_url: {
            url: "https://stmstd.s3.amazonaws.com/development/location/img_url/35/35_2-d85876cea2d0933c99d99177ddec36e0.png",
            thumb: {
                url: "https://stmstd.s3.amazonaws.com/development/location/img_url/35/thumb_35_2-d85876cea2d0933c99d99177ddec36e0.png"
            },
            big: {
                url: "https://stmstd.s3.amazonaws.com/development/location/img_url/35/big_35_2-d85876cea2d0933c99d99177ddec36e0.png"
            },
            email: {
                url: "https://stmstd.s3.amazonaws.com/development/location/img_url/35/email_35_2-d85876cea2d0933c99d99177ddec36e0.png"
            }
        }
    },
    img_high_url: "/assets/[email protected]",
    time_zone: "Copenhagen",
    hosted_datas: [{
        id: 10,
        place_id: 35,
        place_type: "Location",
        data: {
            layout_template: "",
            layout_template_view: "",
            header: "VELKOMMEN TIL HAPS",
            sub_header1: "SE MENU OG BESTIL DIREKTE",
            sub_header2: "",
            about_us_header: "Velkommen til HAPS i Fiolstræde",
            about_us: "I 2012 slog HAPS dørene op i Fiolstræde. Vi laver ærlig, sund mad og juice, der er til at betale. Husk at vi også leverer frokost og catering. Kontakt os på 33 33 02 10. ",
            search_suggestion: "salat",
            footer_left_text: "",
            social_media_fallback_header: "",
            social_media_fallback_text: "",
            dk_smiley_link_text: "Se Smiley",
            left_header: "",
            left_content: "",
            left_big_phone: "33 33 02 10",
            url_logo: "haps_stor.png",
            url_small_logo: "Haps_smallestesss.png",
            url_main_image: "haps_baggrund.jpg",
            footer_left_img: "powdbtmini.png",
            google_description: "",
            video_url_top_mp4: ""
        },
        url_logo: "https://stmstd.s3.amazonaws.com/development/hosted_data/url_logo/10/haps_stor.png",
        url_small_logo: "https://stmstd.s3.amazonaws.com/development/hosted_data/url_small_logo/10/Haps_smallestesss.png",
        url_main_image: "https://stmstd.s3.amazonaws.com/development/hosted_data/url_main_image/10/haps_baggrund.jpg",
        footer_left_img: "https://stmstd.s3.amazonaws.com/development/hosted_data/footer_left_img/10/powdbtmini.png",
        url_chainview_img: null,
        chain_view_table_booking_img: null
    }],
    schedules: [{
        id: 70,
        start: "2013-06-17T00:00:00.000+02:00",
        finish: "2027-08-30T14:38:00.000+02:00",
        cron: null,
        mode: "on",
        range: "monday (10:00-20:00), tuesday (10:00-20:00), wednesday (10:00-20:00), thursday (10:00-20:00), friday (10:00-20:00), saturday (10:00-20:00), sunday (12:00-18:00)",
        status: "active",
        priority: null,
        obj_type: "Location",
        obj_id: 35,
        text: "mandag - lørdag (10:00 - 21:00), søndag (12:00 - 18:00)"
    }],
    addresses: [{
        id: 29,
        owner_id: 35,
        owner_type: "Location",
        street: "Fiolstræde 38",
        street2: "",
        city: "København K",
        zip: "1171",
        state: "",
        country: "Denmark",
        status: null,
        lat: null,
        lng: null,
        geocoded_address: null,
        name_door: null,
        door_comments: null,
        full_address: "Fiolstræde 38 , 1171 København K , Denmark"
    }]
}

I want to access full_address in addresses.

This object is called location.

I have tried {{location.addresses.full_address}} but this isn't working. Similarly, {{location.schedule.range}} doesn't work.

I appreciate your help!

1
  • {{location.addresses[0].full_address}} possibly? It looks like your hashes are arrays and so you need to get the first element in the array Commented Nov 28, 2015 at 7:15

3 Answers 3

1

location.addresses and location.schedules are both arrays.

Try location.addresses[0].full_address. It should work.

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

Comments

1

Both addresses and schedules are arrays. You have one object in each these arrays. You need to access it like this:

{{location.addresses[0].full_address}}
{{location.schedules[0].range}}

Comments

0

You are missing the array index while accessing array element. You can get the full address by {{location.addresses[0].full_address}} . Similarly get range using {{location.schedules[0].range}}

Comments

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.