Text Processingflags: g
JSON Key-Value Pair (Simple)
Extract simple `"key": value` pairs from JSON-ish text (strings, numbers, booleans, null).
Try it in RegexPro →Available in
Pattern
regexengine-agnostic
"([^"\\]+)"\s*:\s*("[^"\\]*"|-?\d+(?:\.\d+)?|true|false|null) (flags: g)Raw source: "([^"\\]+)"\s*:\s*("[^"\\]*"|-?\d+(?:\.\d+)?|true|false|null)
How it works
"([^"\\]+)" captures the key — non-quote, non-backslash chars (so escaped quotes break the match — by design, this is a quick parser, not a strict one). \s*:\s* matches the separator. The value group covers strings, signed integers/decimals, true, false, and null. Use a real JSON parser for production!
Examples
Input
{"name": "alice", "age": 30, "active": true}Matches
"name": "alice""age": 30"active": true
Input
"timeout": 5000, "retries": nullMatches
"timeout": 5000"retries": null
Input
no json hereNo match
—Common use cases
- •Quick log-line scraping when JSON.parse would be overkill
- •Extracting fields from semi-JSON config formats (HCL, JSON5)
- •Search-and-grep over JSON lines (jq alternatives)
- •Static analysis of JSON snippets in source