mORMot and Open Source friends
Check-in [266dbf281c]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:{680} fixed TTextWriter.AddJSONToXML / JSONToXML() so that empty JSON objects {} are handled as expected
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 266dbf281c6fe7873eedee08079d96d5e9bd01c7
User & Date: ab 2015-01-06 10:37:09
Context
2015-01-07
09:20
{681} added HaraldSimon's patch for EMR_BITBLT/EMR_STRETCHBLT check-in: dfe5ad03f3 user: ab tags: trunk
2015-01-06
10:37
{680} fixed TTextWriter.AddJSONToXML / JSONToXML() so that empty JSON objects {} are handled as expected check-in: 266dbf281c user: ab tags: trunk
2015-01-05
19:01
{679} small documentation fix check-in: 1f34e1c0d4 user: ab tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to SynCommons.pas.

33044
33045
33046
33047
33048
33049
33050


33051
33052
33053
33054
33055
33056
33057
33058
33059
33060
33061
33062
33063
33064
33065
33066
33067
33068
33069
33070
33071
33072
33073
        Add('>');
        inc(n);
      until objEnd=']';
    end;
  end;
  '{': begin
    repeat inc(JSON) until not(JSON^ in [#1..' ']);


    repeat
      Name := GetJSONPropName(JSON);
      if Name=nil then
        exit;
      if JSON^ in [#1..' '] then repeat inc(JSON) until not(JSON^ in [#1..' ']);
      if JSON^='[' then // arrays are written as list of items, without root
        JSON := AddJSONToXML(JSON,Name,@objEnd) else begin
        Add('<');
        AddXmlEscape(Name);
        Add('>');
        JSON := AddJSONToXML(JSON,Name,@objEnd);
        Add('<','/');
        AddXmlEscape(Name);
        Add('>');
      end;
    until objEnd='}';
  end;
  else begin
    Value := GetJSONField(JSON,result,nil,EndOfObject); // let wasString=nil
    if Value=nil then
      AddShort('null') else
      AddXmlEscape(Value);
    exit;






>
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|







33044
33045
33046
33047
33048
33049
33050
33051
33052
33053
33054
33055
33056
33057
33058
33059
33060
33061
33062
33063
33064
33065
33066
33067
33068
33069
33070
33071
33072
33073
33074
33075
        Add('>');
        inc(n);
      until objEnd=']';
    end;
  end;
  '{': begin
    repeat inc(JSON) until not(JSON^ in [#1..' ']);
    if JSON^='}' then
      repeat inc(JSON) until not(JSON^ in [#1..' ']) else
      repeat
        Name := GetJSONPropName(JSON);
        if Name=nil then
          exit;
        if JSON^ in [#1..' '] then repeat inc(JSON) until not(JSON^ in [#1..' ']);
        if JSON^='[' then // arrays are written as list of items, without root
          JSON := AddJSONToXML(JSON,Name,@objEnd) else begin
          Add('<');
          AddXmlEscape(Name);
          Add('>');
          JSON := AddJSONToXML(JSON,Name,@objEnd);
          Add('<','/');
          AddXmlEscape(Name);
          Add('>');
        end;
      until objEnd='}';
  end;
  else begin
    Value := GetJSONField(JSON,result,nil,EndOfObject); // let wasString=nil
    if Value=nil then
      AddShort('null') else
      AddXmlEscape(Value);
    exit;

Changes to SynopseCommit.inc.

1
'1.18.679'
|
1
'1.18.680'