質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
JSON

JSON(JavaScript Object Notation)は軽量なデータ記述言語の1つである。構文はJavaScriptをベースとしていますが、JavaScriptに限定されたものではなく、様々なソフトウェアやプログラミング言語間におけるデータの受け渡しが行えるように設計されています。

jQuery

jQueryは、JavaScriptライブラリのひとつです。 簡単な記述で、JavaScriptコードを実行できるように設計されています。 2006年1月に、ジョン・レシグが発表しました。 jQueryは独特の記述法を用いており、機能のほとんどは「$関数」や「jQueryオブジェクト」のメソッドとして定義されています。

Q&A

解決済

1回答

987閲覧

productsの中にあるそれぞれのproduct_idの番号を取得してnameやmain_imageを取得してJqueryで表示させたい。

Anfanger

総合スコア24

JSON

JSON(JavaScript Object Notation)は軽量なデータ記述言語の1つである。構文はJavaScriptをベースとしていますが、JavaScriptに限定されたものではなく、様々なソフトウェアやプログラミング言語間におけるデータの受け渡しが行えるように設計されています。

jQuery

jQueryは、JavaScriptライブラリのひとつです。 簡単な記述で、JavaScriptコードを実行できるように設計されています。 2006年1月に、ジョン・レシグが発表しました。 jQueryは独特の記述法を用いており、機能のほとんどは「$関数」や「jQueryオブジェクト」のメソッドとして定義されています。

0グッド

0クリップ

投稿2018/09/19 06:50

編集2018/09/19 07:05

productsの中にあるそれぞれのproduct_idの番号を取得してnameやmain_imageを取得してJqueryで表示させたい場合、どのような記述が必要なんでしょうか。おしえてください。

{ "products": [ { "product_id": "11", "product_code_min": "inf02", "product_code_max": "inf02", "name": "インフルブロックのどあめ ブルーベリー味", "comment1": null, "comment2": null, "comment3": null, "main_list_comment": "<燕の巣を使った奇跡のキャンディ>", "main_image": "11020721_56369067217cb.jpg", "main_list_image": "11020721_563690672a095.jpg", "main_large_image": "11020721_56369067196de.jpg", "price01_min": null, "price01_max": null, "price02_min": "2500", "price02_max": "2500", "stock_min": null, "stock_max": null, "stock_unlimited_min": "1", "stock_unlimited_max": "1", "deliv_date_id": "2", "status": "1", "del_flg": "0", "update_date": "2017-08-24 10:14:46", "price01_min_inctax": null, "price01_max_inctax": null, "price02_min_inctax": 2700, "price02_max_inctax": 2700, "price01_min_format": "0", "price01_max_format": "0", "price02_min_format": "2,500", "price02_max_format": "2,500", "price01_min_inctax_format": "0", "price01_max_inctax_format": "0", "price02_min_inctax_format": "2,700", "price02_max_inctax_format": "2,700", "price01_min_tax_format": "0", "price01_max_tax_format": "0", "price02_min_tax_format": "2,700", "price02_max_tax_format": "2,700", "papc2": { "value_id": "103", "product_id": "11", "column_id": "2", "value": "11181905_564c4d7b4000e.jpg", "name": "サムネイル画像01", "type": "image", "required": "0", "max_length": null }, "papc3": { "value_id": "104", "product_id": "11", "column_id": "3", "value": "01271507_588ae396af94a.jpg", "name": "サムネイル画像02", "type": "image", "required": "0", "max_length": null }, "papc4": { "value_id": "101", "product_id": "11", "column_id": "4", "value": "東京都", "name": "原産地", "type": "text", "required": "0", "max_length": "50" }, "papc5": { "value_id": "102", "product_id": "11", "column_id": "5", "value": "常温", "name": "常温・冷蔵・冷凍", "type": "text", "required": "0", "max_length": "50" }, { "product_id": "12", "product_code_min": "ish02", "product_code_max": "ish02", "name": "石垣牛 しゃぶしゃぶBセット", "comment1": null, "comment2": null, "comment3": null, "main_list_comment": "〈甘くて風味の良い、口溶けのよいお肉〉", "main_image": "11020724_5636911b69809.jpg", "main_list_image": "11020724_5636911b6f1fb.jpg", "main_large_image": "11020724_5636911b63a5c.jpg", "price01_min": null, "price01_max": null, "price02_min": "15000", "price02_max": "15000", "stock_min": null, "stock_max": null, "stock_unlimited_min": "1", "stock_unlimited_max": "1", "deliv_date_id": "3", "status": "1", "del_flg": "0", "update_date": "2017-08-23 16:44:17", "price01_min_inctax": null, "price01_max_inctax": null, "price02_min_inctax": 16200, "price02_max_inctax": 16200, "price01_min_format": "0", "price01_max_format": "0", "price02_min_format": "15,000", "price02_max_format": "15,000", "price01_min_inctax_format": "0", "price01_max_inctax_format": "0", "price02_min_inctax_format": "16,200", "price02_max_inctax_format": "16,200", "price01_min_tax_format": "0", "price01_max_tax_format": "0", "price02_min_tax_format": "16,200", "price02_max_tax_format": "16,200", "papc2": { "value_id": "355", "product_id": "12", "column_id": "2", "value": null, "name": "サムネイル画像01", "type": "image", "required": "0", "max_length": null }, "papc3": { "value_id": "356", "product_id": "12", "column_id": "3", "value": null, "name": "サムネイル画像02", "type": "image", "required": "0", "max_length": null }, "papc4": { "value_id": "353", "product_id": "12", "column_id": "4", "value": "沖縄県", "name": "原産地", "type": "text", "required": "0", "max_length": "50" }, "papc5": { "value_id": "354", "product_id": "12", "column_id": "5", "value": "冷凍", "name": "常温・冷蔵・冷凍", "type": "text", "required": "0", "max_length": "50" } } ] }

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

SE-studying-now

2018/09/19 06:57

productsの1つ目の要素と2つ目の要素の間の括弧が足りてないみたいですよ。
guest

回答1

0

ベストアンサー

提示のデータがおかしいようですが

javascript

1var obj={ 2 "products": [ 3 { 4 "product_id": "11", 5 }, 6 { 7 "product_id": "12", 8 }, 9 ] 10}; 11var list=obj.products.map(function(x,y){ 12 return {product_id:x.product_id,name:x.name,main_image:x.main_image}; 13}); 14console.log(list);

投稿2018/09/19 07:09

編集2018/09/19 07:10
yambejp

総合スコア114839

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問