/
(?(DEFINE)
(?<quote>['"])
(?<pair>
(?>
\w+
|(?:
(?<pairQuote>(?"e))[^'"]+?\k<pairQuote>
)
)
\s*\:
)
(?<string>
(?<stringQuote>(?"e))[\S\s]*?(?<!\\)\k<stringQuote>
)
(?<integer>\-?\d+(?:\.\d+)?(?:e[-+]\d+)?)
(?<scalar>true|false|null|(?&integer))
(?<elements>
\s*(?&value)
(?(R&array)|(?>(?:\s*\,(?&elements))|\s*))
)
(?<array>\[(?>(?&elements)|\s*)\])
(?<value>
(?&object)
|(?&string)
|(?&scalar)
|(?&array)
)
(?<members>
\s*(?&pair)\s*(?&value)
(?(R&object)|(?>(?:\s*\,(?&members))|\s*))
)
(?<object>\{(?&members)?\})
)
\A(?&object)\Z
/
gimx