-1

以下のように、Struts Action から json データを取得します。このデータを JSP ページで事前設定したいのですが、.$each または attr を使用しようとしましたが、うまくいきません。Json2.js を使用します JSON.stringfy() これらのデータを取得します、では、その中の各キーと値を取得するにはどうすればよいでしょうか?

[{"agreementNumber":"161446628","employeeIndicator":"N","enrollmentSrc":"363","fepIndicator":"N","groupCancelDate":null,"groupCancelDateTime":0,"groupCnlDate": "","groupEffDate":"20070701","groupEffectiveDate":{"日付":1,"日":0,"時間":0,"分":0,"月":6,"秒": 0,"time":1183262400000,"timezoneOffset":240,"year":107},"groupEffectiveDateTime":1183262400000,"groupName":"ウェストミンスター カレッジ","groupNumber":"01501701 ","index":"1 ","memberList":{"enrollmetSrc":"363","groupNumber":"01501701","memberList":[{"契約番号":"161446628","生年月日":{"日付":10,"日":0,"時間":0,"分":0,"月":1," seconds":0,"time":-217450800000,"timezoneOffset":300,"year":63},"birthDateTime":-217450800000,"cancelDate":null,"cancelDateTime":0,"classCode":" I3 ","effectiveDate":{"日付":1,"日":0,"時間":0,"分":0,"月":6,"秒":0,"時間":1183262400000," timezoneOffset":240,"year":107},"effectiveDateTime":1183262400000,"firstName":"KENNETH ","gender":"M","groupName":"","groupNumber":"01501701 ","lastName":"ROMIG ","medicareAdvantage":"","memberId":375315,"middleName":"J ","pin":"1","preTtlName":" ","re​​lation" :"Self","re​​lationCode":"1","sucTtlName":" "},{"agreementNumber":"161446628","birthDate":{"date":23,"day":5,"hours" :0,"分":0,"月":7,"秒":0,"時刻":-200692800000,"タイムゾーンオフセット":240,"年":63},"生年月日時刻":-200692800000,"キャンセル日":null,"cancelDateTime":0,"classCode":" I3","effectiveDate":{"date":1,"day":0,"hours":0,"minutes":0,"month":6,"seconds":0,"time":1183262400000,"timezoneOffset":240,"year":107},"effectiveDateTime":1183262400000,"firstName":"キンバリー ", "gender":"F","groupName":"","groupNumber":"01501701 ","lastName":"ROMIG ","medicareAdvantage":"","memberId":1424959,"middleName":"G ","pin":"3","preTtlName":" ","re​​lation":"Spouse","re​​lationCode":"2","sucTtlName":" "},{"agreementNumber":"161446628", "birthDate":{"date":8,"day":1,"hours":0,"minutes":0,"month":0,"seconds":0,"time":631774800000,"timezoneOffset":300,"year":90},"birthDateTime":631774800000,"cancelDate":null,"cancelDateTime":0,"classCode":" I3", "effectiveDate":{"date":1,"day":0,"hours":0,"minutes":0,"month":6,"seconds":0,"time":1183262400000,"timezoneOffset" :240,"年":107},"effectiveDateTime":1183262400000,"firstName":"NICOLE ","gender":"F","groupName":"","groupNumber":"01501701 ","lastName" :"CRUMBACHER ","medicareAdvantage":"","memberId":375314,"middleName":"A ","ピン":"4","preTtlName":" ","re​​lation":"Child","re​​lationCode":"3","sucTtlName":" "},{"agreementNumber":"161446628","birthDate":{"date":7, "日":6,"時":0,"分":0,"月":6,"秒":0,"時刻":994478400000,"タイムゾーンオフセット":240,"年":101}," birthDateTime":994478400000,"cancelDate":null,"cancelDateTime":0,"classCode":" I3","effectiveDate":{"date":1,"day":0,"hours":0,"minutes ":0,"month":6,"seconds":0,"time":1183262400000,"timezoneOffset":240,"year":107},"effectiveDateTime":1183262400000,"firstName":"NATHAN ","gender":"M","groupName":"","groupNumber":"01501701 ","lastName":"ROMIG ","medicareAdvantage":"","memberId":1424960,"middleName ":"J ","pin":"6","preTtlName":" ","re​​lation":"Child","re​​lationCode":"3","sucTtlName":" "}]},"ownerCode" :"HM"}]"relation":"Child","re​​lationCode":"3","sucTtlName":" "}]},"ownerCode":"HM"}]"relation":"Child","re​​lationCode":"3","sucTtlName":" "}]},"ownerCode":"HM"}]

4

1 に答える 1

0

あなたのjsonオブジェクトは複雑な構造を持っているので、関数を適切にマッピングする方法を書くつもりはありませんが、それをよりよく理解し、それを操作する方法をいくつか提供します.

json オブジェクトをより明確に表示するには、オンライン json パーサーhttp://json.parser.online.fr/を使用して、そこに json オブジェクトを貼り付けるだけで、右側にツリーのような構造が表示されます。

ここでは、json オブジェクトのプロパティjsfidleにアクセスする方法の例を見ることができます 。

于 2012-06-11T19:39:11.703 に答える