#!/bin/bash

# Boucle sur chaque ligne
psql -h 127.0.0.1 -d sql -U sql -At -c \
"SELECT id, data::text FROM item" |
while IFS=$'\|' read -r id json; do
  echo "$json" | jq -S '.' > "data/json/${id}.json"
done
