1

I have this js object. I'm trying to get to the legacy_publishers publisher_name

{"data":[{"title_id":7,"title":"Dead By Midnight","title_alpha":"Dead","display_title":"Dead By Midnight","subtitle":"","isbn10":"","isbn13":"9781420117554","primary_isbn13":"9781420117554","asin":"","format":"4","subformat":"1","publish_date":"2010-02-01","series_id":495,"series":{"series_id":495,"firebrand_series_id":null,"name":"Dead By","description":"dsfasdf","created":"2014-07-31T06:10:52.000-04:00","modified":null,"slug":"dead-by","legacy_slug":null},"volume":1,"pub_season":"","pub_year":"2010","bisac1":"FIC027110","bisac2":"","bisac3":"","major_category":"","minor_category":"","min_age":null,"max_age":null,"min_grade":null,"max_grade":null,"ean":"","barcode":"","dewey_decimal":"","lib_of_congress":"","spanish_language":0,"target_audience":0,"language":"","edition":"","pages":0,"number_in_series":0,"trimsize":"","filesize":"","duration_hours":0,"duration_minutes":0,"discs":0,"download":null,"size_unit":"","digitization_date":null,"us_on_sale_date":null,"aus_on_sale_date":null,"can_on_sale_date":null,"uk_on_sale_date":null,"us_list_price":"","aus_list_price":"","can_list_price":"","uk_list_price":"","isPrimary":"Y","modified":"2015-08-04T10:37:45.000-04:00","modifier":92,"activated":null,"active":"X","flagged_string":"","created":"2010-03-04T06:28:05.000-05:00","assets_id":"29012","book_details":null,"exclude_goodreads":"Y","series_description":"","review_quote1":"<p>&ldquo;Masterful!&rdquo; &mdash;<em>Linda Howard, New York Times bestselling author on Cold Hearted</em> - <i>Linda Howard</i></p><p>&ldquo;A powerful story that kept me up very late&mdash;with all the lights on.&rdquo; &mdash;<em>Kay Hooper, New York Times bestselling author on As Good as Dead</em> - <i>Kay Hooper</i></p>","territory_id":27,"featured_newsletter_id":0,"retailer_discovery_check":"2013-07-21T09:04:25.000-04:00","suppress_retailer_approval":false,"suppress_retailer_approval_reason":null,"ebb_description":null,"slug":"dead-by-midnight","legacy_slug":"dead-by-midnight","us_agency_price":null,"firebrand_title_id":null,"ebb_label":null,"ebb_end_sale_date":null,"ebb_downprice":null,"book_club":null,"best_seller":null,"discovery":"Y","narrator_id":null,"legacy_publishers":[{"publisher_id":1,"publisher_name":"Kensington"}],"legacy_contributors":[{"author_id":1,"contact_id":1,"contact":{"display_name":"Beverly Barton"}}]}]}

I keep getting object object. I'm not sure what I'm doing wrong.

3
  • getting "object object" is usually a sign of trying to convert an object to a string, so maybe you do have the right reference, you're just outputting it incorrectly. Either way, we need to see more code to tell. Commented Aug 4, 2015 at 19:36
  • Can you show what you tried ? Commented Aug 4, 2015 at 19:40
  • It should be obj.data[0].legacy_publishers[0].publisher_name id the entire object is names obj Commented Aug 4, 2015 at 19:43

1 Answer 1

3

data has an array property, so does legacy_publishers - make sure you specify the array index:

data[0].legacy_publishers[0].publisher_name
Sign up to request clarification or add additional context in comments.

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.