我需要從下面的對象訪問這些值的值:'{"key": "1234","customername":"john","customerMobile":"12345678"}
。如何訪問密鑰和值?
我在你的JSON query_responses.transactionEnvelope.payload.data.actions.
error: actions undefined
{ validationCode: 0,
transactionEnvelope:
{ signature: <Buffer 30 44 02 20 6b 30 1d 68 4e ef e0 00 13 b8 75 d0 24 24 db eb 31 4a 9c 39 62 11 5a 67 30 54 67 d4 bf fe 8c b5 02 20 4e 94 bd 08 89 a9 ee 69 38 aa 7e 5d ... >,
payload:
{ header:
{ channel_header:
{ type: 'ENDORSER_TRANSACTION',
version: 3,
timestamp: 'Sun Oct 08 2017 10:52:28 GMT+0530 (India Standard Time)',
channel_id: 'mychannel',
tx_id: '72a92b12266fbb7cb08fff028d909ef9a0801845b63484589740095721ef12f9',
epoch: 0,
extension: <Buffer 12 09 12 07 76 6c 6d 5f 76 36 31> },
signature_header:
{ creator:
{ Mspid: 'Org1MSP',
IdBytes: '-----BEGIN CERTIFICATE-----\nMIICGDCCAb+gAwIBAgIQFSxnLAGsu04zrFkAEwzn6zAKBggqhkjOPQQDAjBzMQsw\nCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy\nYW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEcMBoGA1UEAxMTY2Eu\nb3JnMS5leGFtcGxlLmNvbTAeFw0xNzA4MzEwOTE0MzJaFw0yNzA4MjkwOTE0MzJa\nMFsxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1T\nYW4gRnJhbmNpc2NvMR8wHQYDVQQDDBZBZG1pbkBvcmcxLmV4YW1wbGUuY29tMFkw\nEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEV1dfmKxsFKWo7o6DNBIaIVebCCPAM9C/\nsLBt4pJRre9pWE987DjXZoZ3glc4+DoPMtTmBRqbPVwYcUvpbYY8p6NNMEswDgYD\nVR0PAQH/BAQDAgeAMAwGA1UdEwEB/wQCMAAwKwYDVR0jBCQwIoAgQjmqDc122u64\nugzacBhR0UUE0xqtGy3d26xqVzZeSXwwCgYIKoZIzj0EAwIDRwAwRAIgXMy26AEU\n/GUMPfCMs/nQjQME1ZxBHAYZtKEuRR361JsCIEg9BOZdIoioRivJC+ZUzvJUnkXu\no2HkWiuxLsibGxtE\n-----END CERTIFICATE-----\n' },
nonce: <Buffer bf b1 5e 2d 80 f3 8d 01 57 6b 42 00 0c da af 53 17 22 f9 b3 43 2e 85 76> } },
data:
{ actions:
[ { header:
{ creator:
{ Mspid: 'Org1MSP',
IdBytes: '-----BEGIN CERTIFICATE-----\nMIICGDCCAb+gAwIBAgIQFSxnLAGsu04zrFkAEwzn6zAKBggqhkjOPQQDAjBzMQsw\nCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy\nYW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEcMBoGA1UEAxMTY2Eu\nb3JnMS5leGFtcGxlLmNvbTAeFw0xNzA4MzEwOTE0MzJaFw0yNzA4MjkwOTE0MzJa\nMFsxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1T\nYW4gRnJhbmNpc2NvMR8wHQYDVQQDDBZBZG1pbkBvcmcxLmV4YW1wbGUuY29tMFkw\nEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEV1dfmKxsFKWo7o6DNBIaIVebCCPAM9C/\nsLBt4pJRre9pWE987DjXZoZ3glc4+DoPMtTmBRqbPVwYcUvpbYY8p6NNMEswDgYD\nVR0PAQH/BAQDAgeAMAwGA1UdEwEB/wQCMAAwKwYDVR0jBCQwIoAgQjmqDc122u64\nugzacBhR0UUE0xqtGy3d26xqVzZeSXwwCgYIKoZIzj0EAwIDRwAwRAIgXMy26AEU\n/GUMPfCMs/nQjQME1ZxBHAYZtKEuRR361JsCIEg9BOZdIoioRivJC+ZUzvJUnkXu\no2HkWiuxLsibGxtE\n-----END CERTIFICATE-----\n' },
nonce: <Buffer bf b1 5e 2d 80 f3 8d 01 57 6b 42 00 0c da af 53 17 22 f9 b3 43 2e 85 76> },
payload:
{ chaincode_proposal_payload: { input: <Buffer 0a b5 01 08 01 12 09 12 07 76 6c 6d 5f 76 36 31 1a a5 01 0a 11 43 72 65 61 74 65 54 72 61 6e 73 61 63 74 69 6f 6e 0a 8f 01 7b 22 73 61 6c 65 73 49 44 ... > },
action:
{ proposal_response_payload:
{ proposal_hash: '37d6f8b3d3d1e0a629043df2b3379b4fca62aa9ef793c123161972852d8d8ea1',
extension:
{ results:
{ data_model: 0,
ns_rwset:
[ { namespace: 'lscc',
rwset:
{ reads:
[ { key: 'vlm_v61',
version:
{ block_num: Long { low: 1, high: 0, unsigned: true },
tx_num: Long { low: 0, high: 0, unsigned: true } } } ],
range_queries_info: [],
writes: [] } },
{ namespace: 'vlm_v61',
rwset:
{ reads: [],
range_queries_info: [],
writes:
[ { key: '1234',
is_delete: false,
value: '{"key": "1234","customername":"john","customerMobile":"12345678"}' } ] } } ] },
events:
{ chaincode_id: '',
tx_id: '',
event_name: '',
payload: <Buffer > },
response: { status: 200, message: '', payload: '' } } },
endorsements:
[ { endorser:
{ Mspid: 'Org1MSP',
IdBytes: '-----BEGIN -----\nMIICGjCCAcCgAwIBAgIRAPlwF/rUZUP9mqN4wSml4iswCgYIKoZIzj0EAwIwczEL\nMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG\ncmFuY2lzY28xGTAXBgNVBAoTEG9yZzEuZXhhbXBsZS5jb20xHDAaBgNVBAMTE2Nh\nLm9yZzEuZXhhbXBsZS5jb20wHhcNMTcwODMxMDkxNDMyWhcNMjcwODI5MDkxNDMy\nWjBbMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMN\nU2FuIEZyYW5jaXNjbzEfMB0GA1UEAxMWcGVlcjAub3JnMS5leGFtcGxlLmNvbTBZ\nMBMGByqGSM49AgEGCCqGSM49AwEHA0IABHihxW6ks3B2+5XdbAVq3CBgxRRRZ22x\nzzpqnD86nKkz7fBElBuhlXl2K6rTxyY2OBOB0ts8keqZ93xueRGymrajTTBLMA4G\nA1UdDwEB/wQEAwIHgDAMBgNVHRMBAf8EAjAAMCsGA1UdIwQkMCKAIEI5qg3Ndtru\nuLoM2nAYUdFFBNMarRst3dusalc2Xkl8MAoGCCqGSM49BAMCA0gAMEUCIQD4j0Rn\ne1rrd0FSCzsR6u+IuuPK5dI/kR/bh7+VLf0TNgIgCfUtkJvfvzVEwZLFoFyjoHtr\ntvwzNUS1U0hEqIaDeo4=\n-----END -----\n' },
signature: <Buffer 30 44 02 20 50 ac 62 22 9a 51 14 cc 21 dc a3 7e 8f 0e 77 ce 6d 1c 74 48 30 18 de 42 39 c1 4a 09 8b 91 05 6c 02 20 18 e6 e2 0d 32 ab b0 fe 38 aa 2e 1e ... > } ] } } } ] } } } }
編輯您的問題以刪除「JSON」。你應該查找什麼「JSON」來理解你正在處理的事情。此外,這裏沒有任何node.js。這只是「Javascript」 - 標籤已更改。 –