This project is read-only.
1
Vote

JSON Object name/value pairs missing or wrong quotes

description

The JSON specification RFC4627 sections 2.2 and 2.5 and requires that the object name and value be enclosed in double quotes:
 
Object Grammar:
  object = begin-object [ member *( value-separator member ) ]
  end-object
 
  member = string name-separator value
 
String Grammar:
     string = quotation-mark *char quotation-mark
 
     char = unescaped /
            escape (
                %x22 /          ; "    quotation mark  U+0022
                %x5C /          ; \    reverse solidus U+005C
                %x2F /          ; /    solidus         U+002F
                %x62 /          ; b    backspace       U+0008
                %x66 /          ; f    form feed       U+000C
                %x6E /          ; n    line feed       U+000A
                %x72 /          ; r    carriage return U+000D
                %x74 /          ; t    tab             U+0009
                %x75 4HEXDIG )  ; uXXXX                U+XXXX
 
     escape = %x5C              ; \
 
     quotation-mark = %x22      ; "
 
     unescaped = %x20-21 / %x23-5B / %x5D-10FFFF
 
Version 1.0 of the PHP Toolkit for ADO.NET Data Services does not include any quotes for the object name, and uses single quotes instead of double quotes for the value.
 
The Microsoft Data Services service tolerates this, however other services that implement various JSON compliant parsers do not.
 
The fix is simply to change SaveResult.php method CreateChangeSetBodyForResourceInJSON to include double quotes around $ProperyName and $propertyValue.

comments