Skip to content

Commit 4f399be

Browse files
committed
Highlight keys in a different color
1 parent fac39c7 commit 4f399be

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Lib/json/tool.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
# the various parts, most notably strings and numbers,
1616
# where the regex given by the spec is much more complex.
1717
_color_pattern = re.compile(r'''
18+
(?P<key>"(\\.|[^"\\])*")(?=:) |
1819
(?P<string>"(\\.|[^"\\])*") |
1920
(?P<number>NaN|-?Infinity|[0-9\-+.Ee]+) |
2021
(?P<boolean>true|false) |
@@ -23,6 +24,7 @@
2324

2425

2526
_colors = {
27+
'key': ANSIColors.INTENSE_BLUE,
2628
'string': ANSIColors.GREEN,
2729
'number': ANSIColors.YELLOW,
2830
'boolean': ANSIColors.CYAN,

0 commit comments

Comments
 (0)