JSON.GET - 아마존 ElastiCache (레디 스OSS)

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

JSON.GET

하나 또는 여러 경로에서 직렬화된 JSON을 반환합니다.

구문

JSON.GET <key> [INDENT indentation-string] [NEWLINE newline-string] [SPACE space-string] [NOESCAPE] [path ...]
  • 키 (필수) — JSON 문서 유형의 레디 스 OSS 키입니다.

  • INDENT/NEWLINE/SPACE(선택 사항) - 반환된 JSON 문자열(즉, "예쁜 인쇄")의 형식을 제어합니다. 각 문자열의 기본값은 빈 문자열이며, 모든 조합으로 재정의될 수 있습니다. 임의의 순서로 지정할 수 있습니다.

  • NOESCAPE - 선택 사항, 레거시 호환성을 위해 사용할 수 있으며 다른 효과는 없습니다.

  • 경로(선택 사항) - 0개 이상의 JSON 경로, 아무 것도 제공되지 않는 경우 기본적으로 루트로 설정됩니다. 경로 인수는 끝에 배치해야 합니다.

반환

향상된 경로 구문.

경로가 하나 지정된 경우,

  • 값의 배열의 직렬화된 문자열을 반환합니다.

  • 값을 선택하지 않은 경우 명령은 빈 배열을 반환합니다.

여러 경로가 지정된 경우,

  • 각 경로가 키인 문자열화된 JSON 객체를 반환합니다.

  • 향상된 경로 구문과 제한된 경로 구문이 혼합된 경우 결과는 향상된 구문을 따릅니다.

  • 경로가 없는 경우 해당 값은 빈 배열입니다.

향상된 경로 구문.

127.0.0.1:6379> JSON.SET k1 . '{"firstName":"John","lastName":"Smith","age":27,"weight":135.25,"isAlive":true,"address":{"street":"21 2nd Street","city":"New York","state":"NY","zipcode":"10021-3100"},"phoneNumbers":[{"type":"home","number":"212 555-1234"},{"type":"office","number":"646 555-4567"}],"children":[],"spouse":null}' OK 127.0.0.1:6379> JSON.GET k1 $.address.* "[\"21 2nd Street\",\"New York\",\"NY\",\"10021-3100\"]" 127.0.0.1:6379> JSON.GET k1 indent "\t" space " " NEWLINE "\n" $.address.* "[\n\t\"21 2nd Street\",\n\t\"New York\",\n\t\"NY\",\n\t\"10021-3100\"\n]" 127.0.0.1:6379> JSON.GET k1 $.firstName $.lastName $.age "{\"$.firstName\":[\"John\"],\"$.lastName\":[\"Smith\"],\"$.age\":[27]}" 127.0.0.1:6379> JSON.SET k2 . '{"a":{}, "b":{"a":1}, "c":{"a":1, "b":2}}' OK 127.0.0.1:6379> json.get k2 $..* "[{},{\"a\":1},{\"a\":1,\"b\":2},1,1,2]"

제한된 경로 구문.

127.0.0.1:6379> JSON.SET k1 . '{"firstName":"John","lastName":"Smith","age":27,"weight":135.25,"isAlive":true,"address":{"street":"21 2nd Street","city":"New York","state":"NY","zipcode":"10021-3100"},"phoneNumbers":[{"type":"home","number":"212 555-1234"},{"type":"office","number":"646 555-4567"}],"children":[],"spouse":null}' OK 127.0.0.1:6379> JSON.GET k1 .address "{\"street\":\"21 2nd Street\",\"city\":\"New York\",\"state\":\"NY\",\"zipcode\":\"10021-3100\"}" 127.0.0.1:6379> JSON.GET k1 indent "\t" space " " NEWLINE "\n" .address "{\n\t\"street\": \"21 2nd Street\",\n\t\"city\": \"New York\",\n\t\"state\": \"NY\",\n\t\"zipcode\": \"10021-3100\"\n}" 127.0.0.1:6379> JSON.GET k1 .firstName .lastName .age "{\".firstName\":\"John\",\".lastName\":\"Smith\",\".age\":27}"