CouchDB outputs JSON strings with internal properties such as the document ID and revision prefixed with an underscore. Furthermore, the revision property's value will always contain a hyphen, as CouchDB revisions are in the form "<revision number>-<hex string>". The following JSON string is an example document from CouchDB.
{"_id":"f42d2e0c5be0a7ab7bdc1cba23fc1d73","_rev":"1-59414e77c768bc202142ac82c2f129de","key":"value"}
ConvertFrom-JSON does not allow underscores or hyphens to appear in property names or values, whilst ConvertTo-JSON is more lenient and will appear to correctly parse anything that is thrown at it. The attached patch file resolves this issue for ConvertFrom-JSON.
It appears from the JSON specification (
http://www.json.org/) that property names and values can be made up of any Unicode character excluding control characters, " (double-quotes) and \ (backslash). Having attempted to implement this myself, this is mostly trivial; however, correctly handling the escape characters require some lookahead to be built into the parser.