$
학습 Linux 안내서
ko
XP:0
퀘스트 111JSON-Sorcerer
+260 XP

Parsing JSON in the Terminal (jq)

이 퀘스트를 위한 인터랙티브 터미널 시작→설치 불필요 • 브라우저에서 바로 실행

개념 및 개요

Modern cloud infrastructure, Kubernetes, Docker, and REST APIs all communicate in JSON. The jq command-line JSON processor is the industry standard tool for slicing, filtering, and mapping structured JSON data in terminal pipelines.

- Pretty-print and syntax validate JSON: cat api.json | jq '.' (or jq '.' api.json).
- Extract specific keys: jq '.version' api.json.
- Access array items and nested object fields: jq '.users[0].name' api.json.
- Output unquoted raw strings (ideal for shell variables): jq -r '.users[0].name' api.json.

Pretty-print api.json using cat api.json | jq '.'. Next, extract the nested name of the first user in raw format using jq -r '.users[0].name' api.json.

명령어 구문 참조

Command / SyntaxDescription
cat api.json | jq '.'Pretty-print JSON data
jq -r '.users[0].name' api.jsonExtract raw nested string value from JSON

검증 목표

  • ○
    Pretty-print api.json with jq '.'
  • ○
    Extract first user name with jq -r '.users[0].name'

퀘스트를 완료할 준비가 되셨나요? 111?