Skip to content

Instantly share code, notes, and snippets.

@Noyabronok
Noyabronok / README-convert-properties-to-json-using-jq.md
Created June 4, 2024 22:41 — forked from drmalex07/README-convert-properties-to-json-using-jq.md
Convert properties to JSON using jq. #properties $json #jq

README

Say we have a properties file at foo.properties.

First, clean-up whitespace and empty lines, store in foo-1.properties:

cat foo.properties | \
    sed 's/[[:space:]]*=[[:space:]]*/=/' | \
    sed 's/[[:space:]]*$//' | \

sed '/^$/d' > foo-1.properties