Skip to content

Instantly share code, notes, and snippets.

@efrence
efrence / json-to-sqlite.md
Created December 24, 2022 19:06 — forked from iAnatoly/json-to-sqlite.md
Convert json to a sqlite database for querying

Sometimes, you need to quickly dump a json file into sqlite, just to run some queries on it. This is a two-step process:

1. convert json to csv

cat file.json | jq -r '.data | map([.field1, .field2, .field3] | @csv)| join("\n")' > file.csv

1a. add headers line into your csv file, i.e.

# ANDROID / ECLIPSE
# built application files
*.apk
*.ap_
# files for the dex VM
*.dex
# Java class files
source :rubygems
# We are not loading Active Record, nor Active Resources etc.
# We can do this in any app by simply replacing the rails gem
# by the parts we want to use.
gem "actionpack", "~> 3.2"
gem "railties", "~> 3.2"
gem "tzinfo"
# Let's use thin