File: json

package info (click to toggle)
duckdb 1.5.1-3
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 299,196 kB
  • sloc: cpp: 865,414; ansic: 57,292; python: 18,871; sql: 12,663; lisp: 11,751; yacc: 7,412; lex: 1,682; sh: 747; makefile: 564
file content (6 lines) | stat: -rwxr-xr-x 177 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
#!/bin/sh
set -e

# Parse a JSON object and extract a field.
result=$(duckdb -c "LOAD json; SELECT json_extract('{\"answer\": 42}', '$.answer');")
echo "$result" | grep -q "42"