[
  {
    "path": ".gitignore",
    "content": "/src/__history\n/unittest/Win32/Debug\n/unittest/__history\n"
  },
  {
    "path": "Clean.bat",
    "content": "@echo off\n\necho Cleaning...\n\ndel /f /q /s *.bak\ndel /f /q /s *.dcu\ndel /f /q /s *.ddp\ndel /f /q /s *.~*\ndel /f /q /s *.local\ndel /f /q /s *.identcache\ndel /f /q /s *.tvsconfig\ndel /f /q /s *.stat\n\ndel /f /q /s *.bpl\ndel /f /q /s *.cbk\ndel /f /q /s *.dcp\ndel /f /q /s *.dsk\ndel /f /q /s *.o\ndel /f /q /s *.rsm\ndel /f /q /s *.skincfg\ndel /f /q /s *.log\ndel /f /q /s *.xml\ndel /f /q /s *.dof\ndel /f /q /s *.mpb\n\nfor /f \"tokens=* delims=\" %%i in ('dir /s /b /a:d __history') do (\n  rd /s /q \"%%i\"\n)\n\nfor /f \"tokens=* delims=\" %%i in ('dir /s /b /a:d __recovery') do (\n  rd /s /q \"%%i\"\n)\n\nfor /f \"tokens=* delims=\" %%i in ('dir /s /b /a:d Win32') do (\n  rd /s /q \"%%i\"\n)\n\nfor /f \"tokens=* delims=\" %%i in ('dir /s /b /a:d Win64') do (\n  rd /s /q \"%%i\"\n)\n\nif \"%1\"==\"\" goto :eof\npause\n"
  },
  {
    "path": "LICENSE",
    "content": "Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"{}\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright {yyyy} {name of copyright owner}\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n\n"
  },
  {
    "path": "README.md",
    "content": "DataSet Converter For Delphi\n=================================\n\nThe DataSetConverter4D it is an API to convert JSON objects for DataSet's and also doing  reverse process, ie, converting DataSet's in JSON.\n\nWorks with the TDataSet, and TJSONObject TJSONArray classes.\n\nTo use this API you must add the \"DataSetConverter4D\\src\" Path in your Delphi or on your project.\n\nConvert DataSet to JSON\n========================\n\nFirst you must have your DataSet and its Fields created.\n\n    uses \n      DataSetConverter4D, \n      DataSetConverter4D.Impl;    \n\n\tvar\n\t  ja: TJSONArray;\n\t  jo: TJSONObject;\n\tbegin\n\t  fCdsCustomers.DataSetField := nil;\n\t  fCdsCustomers.CreateDataSet;\n\t\n\t  fCdsCustomers.Append;\n\t  fCdsCustomers.FieldByName('Id').AsInteger := 1;\n\t  fCdsCustomers.FieldByName('Name').AsString := 'Customers 1';\n\t  fCdsCustomers.FieldByName('Birth').AsDateTime := StrToDateTime('22/01/2014 14:05:03');\n\t  fCdsCustomers.Post;\n\t\n\t  fCdsCustomers.Append;\n\t  fCdsCustomers.FieldByName('Id').AsInteger := 2;\n\t  fCdsCustomers.FieldByName('Name').AsString := 'Customers 2';\n\t  fCdsCustomers.FieldByName('Birth').AsDateTime := StrToDateTime('22/01/2014 14:05:03');\n\t  fCdsCustomers.Post;\n\n      //Convert all records\t\n\t  ja := TConverter.New.DataSet(fCdsCustomers).AsJSONArray;\n\t  \n      //Convert current record\n      jo := TConverter.New.DataSet.Source(fCdsCustomers).AsJSONObject;\n\t\n\t  ja.Free;\n\t  jo.Free;\n\tend;\n    \nConvert JSON to DataSet\n=======================\n\nFirst you must have your DataSet and its Fields created.\n    \n\tuses \n      DataSetConverter4D, \n      DataSetConverter4D.Impl;  \n\n\tJSON_ARRAY =\n\t\t\t[{\n\t\t\t\t\"Id\": 1,\n\t\t\t\t\"Name\": \"Customers 1\",\n\t\t\t\t\"Birth\": \"2014-01-22 14:05:03\"\n\t\t\t}, {\n\t\t\t\t\"Id\": 2,\n\t\t\t\t\"Name\": \"Customers 2\",\n\t\t\t\t\"Birth\": \"2014-01-22 14:05:03\"\n\t\t\t}]      \n\t\t\t\t  \n    JSON_OBJECT =\n\t\t\t{\n\t\t\t\t\"Id\": 2,\n\t\t\t\t\"Name\": \"Customers 2\",\n\t\t\t\t\"Birth\": \"2014-01-22 14:05:03\"\n\t\t\t}\n\tvar\n\t  ja: TJSONArray;\n\t  jo: TJSONObject;\n\tbegin\n\t  fCdsCustomers.CreateDataSet;\n\t\n\t  ja := TJSONObject.ParseJSONValue(TEncoding.ASCII.GetBytes(JSON_ARRAY), 0) as TJSONArray;\n\t  jo := TJSONObject.ParseJSONValue(TEncoding.ASCII.GetBytes(JSON_OBJECT), 0) as TJSONObject;\n\t\n\t  //Convert one record\n      TConverter.New.JSON(jo).ToDataSet(fCdsCustomers);\n\t\n\t  fCdsCustomers.EmptyDataSet;\n\t\n      //Convert all records\n\t  TConverter.New.JSON.Source(ja).ToDataSet(fCdsCustomers);\n\t\n\t  ja.Free;\n\t  jo.Free;\n\tend;\n\nUsing DataSetConverter4D\n============================\n\nUsing this library will is very simple, you simply add the Search Path of your IDE or your project the following directories:\n\n- DataSetConverter4Delphi\\src\\\n\nAnalyze the unit tests they will assist you."
  },
  {
    "path": "src/DataSetConverter4D.Helper.pas",
    "content": "unit DataSetConverter4D.Helper;\n\ninterface\n\nuses\n  System.JSON,\n  Data.DB,\n  DataSetConverter4D,\n  DataSetConverter4D.Impl;\n\ntype\n\n  TDataSetConverterHelper = class helper for TDataSet\n  public\n    function AsJSONObject: TJSONObject;\n    function AsJSONArray: TJSONArray;\n\n    function AsJSONObjectString: string;\n    function AsJSONArrayString: string;\n\n    procedure FromJSONObject(json: TJSONObject);\n    procedure FromJSONArray(json: TJSONArray);\n\n    procedure RecordFromJSONObject(json: TJSONObject);\n  end;\n\nimplementation\n\n{ TDataSetConverterHelper }\n\nfunction TDataSetConverterHelper.AsJSONArray: TJSONArray;\nbegin\n  Result := TConverter.New.DataSet(Self).AsJSONArray;\nend;\n\nfunction TDataSetConverterHelper.AsJSONArrayString: string;\nvar\n  ja: TJSONArray;\nbegin\n  ja := Self.AsJSONArray;\n  try\n    Result := ja.ToString;\n  finally\n    ja.Free;\n  end;\nend;\n\nfunction TDataSetConverterHelper.AsJSONObject: TJSONObject;\nbegin\n  Result := TConverter.New.DataSet(Self).AsJSONObject;\nend;\n\nfunction TDataSetConverterHelper.AsJSONObjectString: string;\nvar\n  jo: TJSONObject;\nbegin\n  jo := Self.AsJSONObject;\n  try\n    Result := jo.ToString;\n  finally\n    jo.Free;\n  end;\nend;\n\nprocedure TDataSetConverterHelper.FromJSONArray(json: TJSONArray);\nbegin\n  TConverter.New.JSON(json).ToDataSet(Self);\nend;\n\nprocedure TDataSetConverterHelper.FromJSONObject(json: TJSONObject);\nbegin\n  TConverter.New.JSON(json).ToDataSet(Self);\nend;\n\nprocedure TDataSetConverterHelper.RecordFromJSONObject(json: TJSONObject);\nbegin\n  TConverter.New.JSON(json).ToRecord(Self);\nend;\n\nend.\n"
  },
  {
    "path": "src/DataSetConverter4D.Impl.pas",
    "content": "unit DataSetConverter4D.Impl;\n\ninterface\n\nuses\n  System.SysUtils,\n  System.Classes,\n  System.JSON,\n  System.DateUtils,\n  System.NetEncoding,\n  System.TypInfo,\n  Data.SqlTimSt,\n  Data.FmtBcd,\n  Data.DB,\n  DataSetConverter4D,\n  DataSetConverter4D.Util;\n\ntype\n\n  TDataSetConverter = class(TInterfacedObject, IDataSetConverter)\n  private\n    fDataSet: TDataSet;\n    fOwns: Boolean;\n    procedure ClearDataSet;\n  protected\n    function GetDataSet: TDataSet;\n\n    function DataSetToJSONObject(dataSet: TDataSet): TJSONObject;\n    function DataSetToJSONArray(dataSet: TDataSet): TJSONArray;\n    function StructureToJSON(dataSet: TDataSet): TJSONArray;\n\n    function Source(dataSet: TDataSet): IDataSetConverter; overload;\n    function Source(dataSet: TDataSet; const owns: Boolean): IDataSetConverter; overload;\n\n    function AsJSONObject: TJSONObject;\n    function AsJSONArray: TJSONArray;\n    function AsJSONStructure: TJSONArray;\n  public\n    constructor Create;\n    destructor Destroy; override;\n\n    class function New: IDataSetConverter; static;\n  end;\n\n  TJSONConverter = class(TInterfacedObject, IJSONConverter)\n  private\n    fJSONObject: TJSONObject;\n    fJSONArray: TJSONArray;\n    fOwns: Boolean;\n    fIsRecord: Boolean;\n    procedure ClearJSONs;\n  protected\n    procedure JSONObjectToDataSet(json: TJSONObject; dataSet: TDataSet; const recNo: Integer; const isRecord: Boolean);\n    procedure JSONArrayToDataSet(json: TJSONArray; dataSet: TDataSet; const isRecord: Boolean);\n    procedure JSONToStructure(json: TJSONArray; dataSet: TDataSet);\n\n    function Source(json: TJSONObject): IJSONConverter; overload;\n    function Source(json: TJSONObject; const owns: Boolean): IJSONConverter; overload;\n\n    function Source(json: TJSONArray): IJSONConverter; overload;\n    function Source(json: TJSONArray; const owns: Boolean): IJSONConverter; overload;\n\n    procedure ToDataSet(dataSet: TDataSet);\n    procedure ToRecord(dataSet: TDataSet);\n    procedure ToStructure(dataSet: TDataSet);\n  public\n    constructor Create;\n    destructor Destroy; override;\n\n    class function New: IJSONConverter; static;\n  end;\n\n  TConverter = class(TInterfacedObject, IConverter)\n  private\n    { private declarations }\n  protected\n    function DataSet: IDataSetConverter; overload;\n    function DataSet(dataSet: TDataSet): IDataSetConverter; overload;\n    function DataSet(dataSet: TDataSet; const owns: Boolean): IDataSetConverter; overload;\n\n    function JSON: IJSONConverter; overload;\n    function JSON(json: TJSONObject): IJSONConverter; overload;\n    function JSON(json: TJSONObject; const owns: Boolean): IJSONConverter; overload;\n\n    function JSON(json: TJSONArray): IJSONConverter; overload;\n    function JSON(json: TJSONArray; const owns: Boolean): IJSONConverter; overload;\n  public\n    class function New: IConverter; static;\n  end;\n\nimplementation\n\n{ TDataSetConverter }\n\nfunction TDataSetConverter.AsJSONArray: TJSONArray;\nbegin\n  Result := DataSetToJSONArray(GetDataSet);\nend;\n\nfunction TDataSetConverter.AsJSONObject: TJSONObject;\nbegin\n  Result := DataSetToJSONObject(GetDataSet);\nend;\n\nconstructor TDataSetConverter.Create;\nbegin\n  inherited Create;\n  fDataSet := nil;\n  fOwns := False;\nend;\n\nfunction TDataSetConverter.DataSetToJSONArray(dataSet: TDataSet): TJSONArray;\nvar\n  bookMark: TBookmark;\nbegin\n  Result := TJSONArray.Create;\n  if Assigned(dataSet) and (not dataSet.IsEmpty) then\n    try\n      bookMark := dataSet.Bookmark;\n      dataSet.First;\n      while not dataSet.Eof do\n      begin\n        Result.AddElement(DataSetToJSONObject(dataSet));\n        dataSet.Next;\n      end;\n    finally\n      if dataSet.BookmarkValid(bookMark) then\n        dataSet.GotoBookmark(bookMark);\n      dataSet.FreeBookmark(bookMark);\n    end;\nend;\n\nfunction TDataSetConverter.DataSetToJSONObject(dataSet: TDataSet): TJSONObject;\nvar\n  i: Integer;\n  key: string;\n  timeStamp: TSQLTimeStamp;\n  nestedDataSet: TDataSet;\n  dft: TDataSetFieldType;\n  bft: TBooleanFieldType;\n  ms: TMemoryStream;\n  ss: TStringStream;\n  fs: TFormatSettings;\nbegin\n  Result := TJSONObject.Create;\n  if Assigned(dataSet) and (not dataSet.IsEmpty) then\n  begin\n    fs.DecimalSeparator := '.';\n    for i := 0 to Pred(dataSet.FieldCount) do\n    begin\n      if dataSet.Fields[i].Visible then\n      begin\n        key := dataSet.Fields[i].FieldName;\n        case dataSet.Fields[i].DataType of\n          TFieldType.ftBoolean:\n            begin\n              bft := BooleanFieldToType(TBooleanField(dataSet.Fields[i]));\n              case bft of\n                bfUnknown, bfBoolean: Result.AddPair(key, BooleanToJSON(dataSet.Fields[i].AsBoolean));\n                bfInteger: Result.AddPair(key, TJSONNumber.Create(dataSet.Fields[i].AsInteger));\n              end;\n            end;\n          TFieldType.ftInteger, TFieldType.ftSmallint, TFieldType.ftShortint:\n            Result.AddPair(key, TJSONNumber.Create(dataSet.Fields[i].AsInteger));\n          TFieldType.ftLongWord, TFieldType.ftAutoInc:\n            begin\n              if not dataSet.Fields[i].IsNull then\n                Result.AddPair(key, TJSONNumber.Create(dataSet.Fields[i].AsWideString))\n              else\n                Result.AddPair(key, TJSONNull.Create);\n            end;\n          TFieldType.ftLargeint:\n            Result.AddPair(key, TJSONNumber.Create(dataSet.Fields[i].AsLargeInt));\n          TFieldType.ftSingle, TFieldType.ftFloat:\n            Result.AddPair(key, TJSONNumber.Create(FloatToStr(dataSet.Fields[i].AsFloat, fs)));\n          ftString, ftWideString, ftMemo, ftWideMemo:\n            begin\n              if not dataSet.Fields[i].IsNull then\n                Result.AddPair(key, TJSONString.Create(dataSet.Fields[i].AsWideString))\n              else\n                Result.AddPair(key, TJSONNull.Create);\n            end;\n          TFieldType.ftDate:\n            begin\n              if not dataSet.Fields[i].IsNull then\n                Result.AddPair(key, TJSONString.Create(DateToISODate(dataSet.Fields[i].AsDateTime)))\n              else\n                Result.AddPair(key, TJSONNull.Create);\n            end;\n          TFieldType.ftTimeStamp, TFieldType.ftDateTime:\n            begin\n              if not dataSet.Fields[i].IsNull then\n                Result.AddPair(key, TJSONString.Create(DateTimeToISOTimeStamp(dataSet.Fields[i].AsDateTime)))\n              else\n                Result.AddPair(key, TJSONNull.Create);\n            end;\n          TFieldType.ftTime:\n            begin\n              if not dataSet.Fields[i].IsNull then\n              begin\n                timeStamp := dataSet.Fields[i].AsSQLTimeStamp;\n                Result.AddPair(key, TJSONString.Create(SQLTimeStampToStr('hh:nn:ss', timeStamp)));\n              end\n              else\n                Result.AddPair(key, TJSONNull.Create);\n            end;\n          TFieldType.ftCurrency:\n            begin\n              if not dataSet.Fields[i].IsNull then\n                Result.AddPair(key, TJSONString.Create(FormatCurr('0.00##', dataSet.Fields[i].AsCurrency)))\n              else\n                Result.AddPair(key, TJSONNull.Create);\n            end;\n          TFieldType.ftFMTBcd, TFieldType.ftBCD:\n            begin\n              if not dataSet.Fields[i].IsNull then\n                Result.AddPair(key, TJSONNumber.Create(BcdToStr(dataSet.Fields[i].AsBcd, fs)))\n              else\n                Result.AddPair(key, TJSONNull.Create);\n            end;\n          TFieldType.ftDataSet:\n            begin\n              dft := DataSetFieldToType(TDataSetField(dataSet.Fields[i]));\n              nestedDataSet := TDataSetField(dataSet.Fields[i]).NestedDataSet;\n              case dft of\n                dfJSONObject:\n                  Result.AddPair(key, DataSetToJSONObject(nestedDataSet));\n                dfJSONArray:\n                  Result.AddPair(key, DataSetToJSONArray(nestedDataSet));\n              end;\n            end;\n          TFieldType.ftGraphic, TFieldType.ftBlob, TFieldType.ftStream:\n            begin\n              ms := TMemoryStream.Create;\n              try\n                TBlobField(dataSet.Fields[I]).SaveToStream(ms);\n                ms.Position := 0;\n                ss := TStringStream.Create;\n                try\n                  TNetEncoding.Base64.Encode(ms, ss);\n                  Result.AddPair(key, TJSONString.Create(ss.DataString));\n                finally\n                  ss.Free;\n                end;\n              finally\n                ms.Free;\n              end;\n            end;\n          TFieldType.ftGuid:\n          begin\n            Result.AddPair(key, DataSet.Fields[I].AsString);\n          end;\n        else\n          raise EDataSetConverterException.CreateFmt('Cannot find type for field \"%s\"', [key]);\n        end;\n      end;\n    end;\n  end;\nend;\n\ndestructor TDataSetConverter.Destroy;\nbegin\n  ClearDataSet;\n  inherited Destroy;\nend;\n\nprocedure TDataSetConverter.ClearDataSet;\nbegin\n  if fOwns then\n    if Assigned(fDataSet) then\n      fDataSet.Free;\n  fDataSet := nil;\nend;\n\nfunction TDataSetConverter.GetDataSet: TDataSet;\nbegin\n  if (fDataSet = nil) then\n    raise EDataSetConverterException.Create('DataSet Uninformed.');\n  Result := fDataSet;\nend;\n\nclass function TDataSetConverter.New: IDataSetConverter;\nbegin\n  Result := TDataSetConverter.Create;\nend;\n\nfunction TDataSetConverter.Source(dataSet: TDataSet; const owns: Boolean): IDataSetConverter;\nbegin\n  ClearDataSet;\n  fDataSet := dataSet;\n  fOwns := owns;\n  Result := Self;\nend;\n\nfunction TDataSetConverter.AsJSONStructure: TJSONArray;\nbegin\n  Result := StructureToJSON(GetDataSet);\nend;\n\nfunction TDataSetConverter.StructureToJSON(dataSet: TDataSet): TJSONArray;\nvar\n  i: Integer;\n  jo: TJSONObject;\nbegin\n  Result :=  TJSONArray.Create;\n  if Assigned(dataSet) and (dataSet.FieldCount > 0) then\n  begin\n    for i := 0 to Pred(dataSet.FieldCount) do\n    begin\n      jo := TJSONObject.Create;\n      jo.AddPair('FieldName', TJSONString.Create(dataSet.Fields[i].FieldName));\n      jo.AddPair('DataType', TJSONString.Create(GetEnumName(TypeInfo(TFieldType), Integer(dataSet.Fields[i].DataType))));\n      jo.AddPair('Size', TJSONNumber.Create(dataSet.Fields[i].Size));\n      Result.AddElement(jo);\n    end;\n  end;\nend;\n\nfunction TDataSetConverter.Source(dataSet: TDataSet): IDataSetConverter;\nbegin\n  Result := Source(dataSet, False);\nend;\n\n{ TJSONConverter }\n\nconstructor TJSONConverter.Create;\nbegin\n  inherited Create;\n  fJSONObject := nil;\n  fJSONArray := nil;\n  fOwns := False;\n  fIsRecord := False;\nend;\n\ndestructor TJSONConverter.Destroy;\nbegin\n  ClearJSONs;\n  inherited Destroy;\nend;\n\nprocedure TJSONConverter.ClearJSONs;\nbegin\n  if fOwns then\n  begin\n    if Assigned(fJSONObject) then\n      fJSONObject.Free;\n    if Assigned(fJSONArray) then\n      fJSONArray.Free;\n  end;\n  fJSONObject := nil;\n  fJSONArray := nil;\nend;\n\nprocedure TJSONConverter.JSONArrayToDataSet(json: TJSONArray; dataSet: TDataSet; const isRecord: Boolean);\nvar\n  jv: TJSONValue;\n  recNo: Integer;\nbegin\n  if Assigned(json) and Assigned(dataSet) then\n  begin\n    recNo := 0;\n    for jv in json do\n    begin\n      if not dataSet.IsEmpty then\n        Inc(recNo);\n      if (jv is TJSONArray) then\n        JSONArrayToDataSet(jv as TJSONArray, dataSet, isRecord)\n      else\n        JSONObjectToDataSet(jv as TJSONObject, dataSet, recNo, isRecord);\n    end;\n  end;\nend;\n\nprocedure TJSONConverter.JSONObjectToDataSet(json: TJSONObject; dataSet: TDataSet; const recNo: Integer; const isRecord: Boolean);\nvar\n  field: TField;\n  jv: TJSONValue;\n  dft: TDataSetFieldType;\n  nestedDataSet: TDataSet;\n  booleanValue: Boolean;\n  ss: TStringStream;\n  sm: TMemoryStream;\nbegin\n  if Assigned(json) and Assigned(dataSet) then\n  begin\n    if (recNo > 0) and (dataSet.RecordCount > 1) then\n      dataSet.RecNo := recNo;\n\n    if isRecord then\n      dataSet.Edit\n    else\n      dataSet.Append;\n\n    for field in dataSet.Fields do\n    begin\n      if Assigned(json.Get(field.FieldName)) then\n        jv := json.Get(field.FieldName).JsonValue\n      else\n        Continue;\n      if field.ReadOnly then\n        Continue;\n      case field.DataType of\n        TFieldType.ftBoolean:\n          begin\n            if jv is TJSONNull then\n              field.Clear\n            else if jv.TryGetValue<Boolean>(booleanValue) then\n              field.AsBoolean := booleanValue;\n          end;\n        TFieldType.ftInteger, TFieldType.ftSmallint, TFieldType.ftShortint, TFieldType.ftLongWord:\n          begin\n            if jv is TJSONNull then\n              field.Clear\n            else\n              field.AsInteger := StrToIntDef(jv.Value, 0);\n          end;\n        TFieldType.ftLargeint, TFieldType.ftAutoInc:\n          begin\n            if jv is TJSONNull then\n              field.Clear\n            else\n              field.AsLargeInt := StrToInt64Def(jv.Value, 0);\n          end;\n        TFieldType.ftCurrency:\n          begin\n            if jv is TJSONNull then\n              field.Clear\n            else\n              field.AsCurrency := StrToCurr(jv.Value);\n          end;\n        TFieldType.ftFloat, TFieldType.ftFMTBcd, TFieldType.ftBCD, TFieldType.ftSingle:\n          begin\n            if jv is TJSONNull then\n              field.Clear\n            else\n              field.AsFloat := jv.GetValue<Double>;\n          end;\n        ftString, ftWideString, ftMemo, ftWideMemo:\n          begin\n            if jv is TJSONNull then\n              field.Clear\n            else\n              field.AsString := jv.Value;\n          end;\n        TFieldType.ftDate:\n          begin\n            if jv is TJSONNull then\n              field.Clear\n            else\n              field.AsDateTime := ISODateToDate(jv.Value);\n          end;\n        TFieldType.ftTimeStamp, TFieldType.ftDateTime:\n          begin\n            if jv is TJSONNull then\n              field.Clear\n            else\n              field.AsDateTime := ISOTimeStampToDateTime(jv.Value);\n          end;\n        TFieldType.ftTime:\n          begin\n            if jv is TJSONNull then\n              field.Clear\n            else\n              field.AsDateTime := ISOTimeToTime(jv.Value);\n          end;\n        TFieldType.ftDataSet:\n          begin\n            dft := DataSetFieldToType(TDataSetField(field));\n            nestedDataSet := TDataSetField(field).NestedDataSet;\n            case dft of\n              dfJSONObject:\n                JSONObjectToDataSet(jv as TJSONObject, nestedDataSet, 0, True);\n              dfJSONArray:\n                begin\n                  nestedDataSet.First;\n                  while not nestedDataSet.Eof do\n                    nestedDataSet.Delete;\n                  JSONArrayToDataSet(jv as TJSONArray, nestedDataSet, False);\n                end;\n            end;\n          end;\n        TFieldType.ftGraphic, TFieldType.ftBlob, TFieldType.ftStream:\n          begin\n            if jv is TJSONNull then\n              field.Clear\n            else\n            begin\n              ss := TStringStream.Create((Jv as TJSONString).Value);\n              try\n                ss.Position := 0;\n                sm := TMemoryStream.Create;\n                try\n                  TNetEncoding.Base64.Decode(ss, sm);\n                  TBlobField(Field).LoadFromStream(sm);\n                finally\n                  sm.Free;\n                end;\n              finally\n                ss.Free;\n              end;\n            end;\n          end;\n      else\n        raise EDataSetConverterException.CreateFmt('Cannot find type for field \"%s\"', [field.FieldName]);\n      end;\n    end;\n    dataSet.Post;\n  end;\nend;\n\nprocedure TJSONConverter.JSONToStructure(json: TJSONArray; dataSet: TDataSet);\nvar\n  jv: TJSONValue;\nbegin\n  if Assigned(json) and Assigned(dataSet) then\n  begin\n    if dataSet.Active then\n      raise EDataSetConverterException.Create('The DataSet can not be active.');\n\n    if (dataSet.FieldCount > 0) then\n      raise EDataSetConverterException.Create('The DataSet can not have predefined Fields.');\n\n    for jv in json do\n    begin\n      NewDataSetField(dataSet, \n        TFieldType(GetEnumValue(TypeInfo(TFieldType), (jv as TJSONObject).GetValue('DataType').Value)), \n        (jv as TJSONObject).GetValue('FieldName').Value, \n        StrToIntDef((jv as TJSONObject).GetValue('Size').Value, 0)\n        );\n    end;\n  end;\nend;\n\nclass function TJSONConverter.New: IJSONConverter;\nbegin\n  Result := TJSONConverter.Create;\nend;\n\nfunction TJSONConverter.Source(json: TJSONObject; const owns: Boolean): IJSONConverter;\nbegin\n  ClearJSONs;\n  fJSONObject := json;\n  fOwns := owns;\n  Result := Self;\nend;\n\nfunction TJSONConverter.Source(json: TJSONObject): IJSONConverter;\nbegin\n  Result := Source(json, false);\nend;\n\nfunction TJSONConverter.Source(json: TJSONArray; const owns: Boolean): IJSONConverter;\nbegin\n  ClearJSONs;\n  fJSONArray := json;\n  fOwns := owns;\n  Result := Self;\nend;\n\nfunction TJSONConverter.Source(json: TJSONArray): IJSONConverter;\nbegin\n  Result := Source(json, false);\nend;\n\nprocedure TJSONConverter.ToDataSet(dataSet: TDataSet);\nbegin\n  if Assigned(fJSONObject) then\n    JSONObjectToDataSet(fJSONObject, dataSet, 0, fIsRecord)\n  else if Assigned(fJSONArray) then\n    JSONArrayToDataSet(fJSONArray, dataSet, fIsRecord)\n  else\n    raise EDataSetConverterException.Create('JSON Value Uninformed.');\nend;\n\nprocedure TJSONConverter.ToRecord(dataSet: TDataSet);\nbegin\n  fIsRecord := True;\n  try\n    ToDataSet(dataSet);\n  finally\n    fIsRecord := False;\n  end;\nend;\n\nprocedure TJSONConverter.ToStructure(dataSet: TDataSet);\nbegin\n  if Assigned(fJSONObject) then\n    raise EDataSetConverterException.Create('To convert a structure only JSONArray is allowed.')\n  else if Assigned(fJSONArray) then\n    JSONToStructure(fJSONArray, dataSet)\n  else\n    raise EDataSetConverterException.Create('JSON Value Uninformed.');\nend;\n\n{ TConverter }\n\nfunction TConverter.DataSet: IDataSetConverter;\nbegin\n  Result := TDataSetConverter.New;\nend;\n\nfunction TConverter.DataSet(dataSet: TDataSet): IDataSetConverter;\nbegin\n  Result := Self.DataSet.Source(dataSet);\nend;\n\nfunction TConverter.DataSet(dataSet: TDataSet; const owns: Boolean): IDataSetConverter;\nbegin\n  Result := Self.DataSet.Source(dataSet, owns);\nend;\n\nfunction TConverter.JSON(json: TJSONObject; const owns: Boolean): IJSONConverter;\nbegin\n  Result := Self.JSON.Source(json, owns);\nend;\n\nfunction TConverter.JSON(json: TJSONObject): IJSONConverter;\nbegin\n  Result := Self.JSON.Source(json);\nend;\n\nfunction TConverter.JSON: IJSONConverter;\nbegin\n  Result := TJSONConverter.New;\nend;\n\nfunction TConverter.JSON(json: TJSONArray; const owns: Boolean): IJSONConverter;\nbegin\n  Result := Self.JSON.Source(json, owns);\nend;\n\nfunction TConverter.JSON(json: TJSONArray): IJSONConverter;\nbegin\n  Result := Self.JSON.Source(json);\nend;\n\nclass function TConverter.New: IConverter;\nbegin\n  Result := TConverter.Create;\nend;\n\nend.\n\n"
  },
  {
    "path": "src/DataSetConverter4D.Util.pas",
    "content": "unit DataSetConverter4D.Util;\n\ninterface\n\nuses\n  System.SysUtils,\n  System.DateUtils,\n  System.JSON,\n  Data.DB,\n  DataSetConverter4D;\n\nfunction DateTimeToISOTimeStamp(const dateTime: TDateTime): string;\nfunction DateToISODate(const date: TDateTime): string;\nfunction TimeToISOTime(const time: TTime): string;\n\nfunction ISOTimeStampToDateTime(const dateTime: string): TDateTime;\nfunction ISODateToDate(const date: string): TDate;\nfunction ISOTimeToTime(const time: string): TTime;\n\nfunction NewDataSetField(dataSet: TDataSet; const fieldType: TFieldType; const fieldName: string;\n  const size: Integer = 0; const origin: string = ''; const displaylabel: string = ''): TField;\n\nfunction BooleanToJSON(const value: Boolean): TJSONValue;\nfunction BooleanFieldToType(const booleanField: TBooleanField): TBooleanFieldType;\nfunction DataSetFieldToType(const dataSetField: TDataSetField): TDataSetFieldType;\nfunction MakeValidIdent(const s: string): string;\n\nimplementation\n\nfunction DateTimeToISOTimeStamp(const dateTime: TDateTime): string;\nvar\n  fs: TFormatSettings;\nbegin\n  fs.TimeSeparator := ':';\n  Result := FormatDateTime('yyyy-mm-dd hh:nn:ss', dateTime, fs);\nend;\n\nfunction DateToISODate(const date: TDateTime): string;\nbegin\n  Result := FormatDateTime('YYYY-MM-DD', date);\nend;\n\nfunction TimeToISOTime(const time: TTime): string;\nvar\n  fs: TFormatSettings;\nbegin\n  fs.TimeSeparator := ':';\n  Result := FormatDateTime('hh:nn:ss', time, fs);\nend;\n\nfunction ISOTimeStampToDateTime(const dateTime: string): TDateTime;\nbegin\n  Result := EncodeDateTime(StrToInt(Copy(dateTime, 1, 4)), StrToInt(Copy(dateTime, 6, 2)), StrToInt(Copy(dateTime, 9, 2)),\n    StrToInt(Copy(dateTime, 12, 2)), StrToInt(Copy(dateTime, 15, 2)), StrToInt(Copy(dateTime, 18, 2)), 0);\nend;\n\nfunction ISODateToDate(const date: string): TDate;\nbegin\n  Result := EncodeDate(StrToInt(Copy(date, 1, 4)), StrToInt(Copy(date, 6, 2)), StrToInt(Copy(date, 9, 2)));\nend;\n\nfunction ISOTimeToTime(const time: string): TTime;\nbegin\n  Result := EncodeTime(StrToInt(Copy(time, 1, 2)), StrToInt(Copy(time, 4, 2)), StrToInt(Copy(time, 7, 2)), 0);\nend;\n\nfunction NewDataSetField(dataSet: TDataSet; const fieldType: TFieldType; const fieldName: string;\n  const size: Integer = 0; const origin: string = ''; const displaylabel: string = ''): TField;\nbegin\n  Result := DefaultFieldClasses[fieldType].Create(dataSet);\n  Result.FieldName := fieldName;\n\n  if (Result.FieldName = '') then\n    Result.FieldName := 'Field' + IntToStr(dataSet.FieldCount + 1);\n\n  Result.FieldKind := fkData;\n  Result.DataSet := dataSet;\n  Result.Name := MakeValidIdent(dataSet.Name + Result.FieldName);\n  Result.Size := size;\n  Result.Origin := origin;\n  if not(displaylabel.IsEmpty) then\n    Result.DisplayLabel := displaylabel;\n\n  if (fieldType in [ftString, ftWideString]) and (size <= 0) then\n    raise EDataSetConverterException.CreateFmt('Size not defined for field \"%s\".', [fieldName]);\nend;\n\nfunction BooleanToJSON(const value: Boolean): TJSONValue;\nbegin\n  if value then\n    Result := TJSONTrue.Create\n  else\n    Result := TJSONFalse.Create;\nend;\n\nfunction BooleanFieldToType(const booleanField: TBooleanField): TBooleanFieldType;\nconst\n  DESC_BOOLEAN_FIELD_TYPE: array [TBooleanFieldType] of string = ('Unknown', 'Boolean', 'Integer');\nvar\n  index: Integer;\n  origin: string;\nbegin\n  Result := bfUnknown;\n  origin := Trim(booleanField.Origin);\n  for index := Ord(Low(TBooleanFieldType)) to Ord(High(TBooleanFieldType)) do\n    if (LowerCase(DESC_BOOLEAN_FIELD_TYPE[TBooleanFieldType(index)]) = LowerCase(origin)) then\n      Exit(TBooleanFieldType(index));\nend;\n\nfunction DataSetFieldToType(const dataSetField: TDataSetField): TDataSetFieldType;\nconst\n  DESC_DATASET_FIELD_TYPE: array [TDataSetFieldType] of string = ('Unknown', 'JSONObject', 'JSONArray');\nvar\n  index: Integer;\n  origin: string;\nbegin\n  Result := dfUnknown;\n  origin := Trim(dataSetField.Origin);\n  for index := Ord(Low(TDataSetFieldType)) to Ord(High(TDataSetFieldType)) do\n    if (LowerCase(DESC_DATASET_FIELD_TYPE[TDataSetFieldType(index)]) = LowerCase(origin)) then\n      Exit(TDataSetFieldType(index));\nend;\n\nfunction MakeValidIdent(const s: string): string;\nvar\n  x: Integer;\n  c: Char;\nbegin\n  SetLength(Result, Length(s));\n  x := 0;\n\n  for c in s do\n  begin\n    if CharInSet(c, ['A'..'Z', 'a'..'z', '0'..'9', '_']) then\n    begin\n      Inc(x);\n      Result[x] := c;\n    end;\n  end;\n\n  SetLength(Result, x);\n\n  if x = 0 then\n    Result := '_'\n  else if CharInSet(Result[1], ['0'..'9']) then\n    Result := '_' + Result;\nend;\n\nend.\n"
  },
  {
    "path": "src/DataSetConverter4D.pas",
    "content": "unit DataSetConverter4D;\n\ninterface\n\nuses\n  System.SysUtils,\n  System.JSON,\n  Data.DB;\n\ntype\n\n  EDataSetConverterException = class(Exception);\n\n  TBooleanFieldType = (bfUnknown, bfBoolean, bfInteger);\n  TDataSetFieldType = (dfUnknown, dfJSONObject, dfJSONArray);\n\n  IDataSetConverter = interface\n    ['{8D995E50-A1DC-4426-A603-762E1387E691}']\n    function Source(dataSet: TDataSet): IDataSetConverter; overload;\n    function Source(dataSet: TDataSet; const owns: Boolean): IDataSetConverter; overload;\n\n    function AsJSONObject: TJSONObject;\n    function AsJSONArray: TJSONArray;\n    function AsJSONStructure: TJSONArray;\n  end;\n\n  IJSONConverter = interface\n    ['{1B020937-438E-483F-ACB1-44B8B2707500}']\n    function Source(json: TJSONObject): IJSONConverter; overload;\n    function Source(json: TJSONObject; const owns: Boolean): IJSONConverter; overload;\n\n    function Source(json: TJSONArray): IJSONConverter; overload;\n    function Source(json: TJSONArray; const owns: Boolean): IJSONConverter; overload;\n\n    procedure ToDataSet(dataSet: TDataSet);\n    procedure ToRecord(dataSet: TDataSet);\n    procedure ToStructure(dataSet: TDataSet);\n  end;\n\n  IConverter = interface\n    ['{52A3BE1E-5116-4A9A-A7B6-3AF0FCEB1D8E}']\n    function DataSet: IDataSetConverter; overload;\n    function DataSet(dataSet: TDataSet): IDataSetConverter; overload;\n    function DataSet(dataSet: TDataSet; const owns: Boolean): IDataSetConverter; overload;\n\n    function JSON: IJSONConverter; overload;\n    function JSON(json: TJSONObject): IJSONConverter; overload;\n    function JSON(json: TJSONObject; const owns: Boolean): IJSONConverter; overload;\n\n    function JSON(json: TJSONArray): IJSONConverter; overload;\n    function JSON(json: TJSONArray; const owns: Boolean): IJSONConverter; overload;\n  end;\n\nimplementation\n\nend.\n"
  },
  {
    "path": "unittest/DataSetConverter4D.UnitTest.pas",
    "content": "unit DataSetConverter4D.UnitTest;\n\ninterface\n\nuses\n  TestFramework,\n  System.Classes,\n  System.SysUtils,\n  System.JSON,\n  Datasnap.DBClient,\n  DataSetConverter4D,\n  DataSetConverter4D.Impl,\n  DataSetConverter4D.Util,\n  DataSetConverter4D.Helper,\n  Data.DB;\n\ntype\n\n  TTestsDataSetConverter = class(TTestCase)\n  private\n    fCdsCustomers: TClientDataSet;\n    fCdsSales: TClientDataSet;\n    fCdsProducts: TClientDataSet;\n  protected\n    procedure SetUp; override;\n    procedure TearDown; override;\n  published\n    procedure TestConvertDataSetToJSONBasic;\n    procedure TestConvertDataSetToJSONComplex;\n    procedure TestConvertJSONToDataSetBasic;\n    procedure TestConvertJSONToDataSetComplex;\n    procedure TestConvertJSONToDataSetOwnsObject;\n    procedure TestConvertDataSetToJSONBasicHelper;\n    procedure TestJSONConverter;\n    procedure Test_Inssue_2;\n    procedure Test_Inssue_7;\n    procedure TestBlobAndText;\n    procedure TestConvertStructureToJSON;\n    procedure TestConvertJSONToStructure;\n    procedure TestConvertDataSetToJSONBasicInvisibleFields;\n    procedure TestConvertJsonToFDMemTable_PR_32;\n  end;\n\nimplementation\n\n{ TTestsDataSetJSONConverter }\n\nprocedure TTestsDataSetConverter.SetUp;\nbegin\n  inherited;\n  FormatSettings.LongDateFormat := 'dd/mm/yyyy hh:nn:ss';\n  FormatSettings.DateSeparator := '/';\n\n  fCdsSales := TClientDataSet.Create(nil);\n  NewDataSetField(fCdsSales, ftInteger, 'Id');\n  NewDataSetField(fCdsSales, ftString, 'Description', 100);\n  NewDataSetField(fCdsSales, ftDate, 'Date');\n  NewDataSetField(fCdsSales, ftTime, 'Time');\n  NewDataSetField(fCdsSales, ftDataSet, 'Customers', 0, 'JSONObject');\n  NewDataSetField(fCdsSales, ftDataSet, 'Products', 0, 'JSONArray');\n\n  fCdsCustomers := TClientDataSet.Create(nil);\n  NewDataSetField(fCdsCustomers, ftInteger, 'Id');\n  NewDataSetField(fCdsCustomers, ftString, 'Name', 100);\n  NewDataSetField(fCdsCustomers, ftDateTime, 'Birth');\n  fCdsCustomers.DataSetField := TDataSetField(fCdsSales.FieldByName('Customers'));\n\n  fCdsProducts := TClientDataSet.Create(nil);\n  NewDataSetField(fCdsProducts, ftInteger, 'Id');\n  NewDataSetField(fCdsProducts, ftString, 'Description', 100);\n  NewDataSetField(fCdsProducts, ftFloat, 'Value');\n  fCdsProducts.DataSetField := TDataSetField(fCdsSales.FieldByName('Products'));\n\n  fCdsSales.CreateDataSet;\nend;\n\nprocedure TTestsDataSetConverter.TearDown;\nbegin\n  inherited;\n  fCdsProducts.Free;\n  fCdsSales.Free;\n  fCdsCustomers.Free;\nend;\n\nprocedure TTestsDataSetConverter.TestBlobAndText;\nconst\n  JSON = '{\"Value\":\"RXplcXVpZWwgSnVsaWFubw==\"}';\nvar\n  cds: TClientDataSet;\n  jo: TJSONObject;\nbegin\n  cds := TClientDataSet.Create(nil);\n  try\n    NewDataSetField(cds, ftBlob, 'Value');\n\n    cds.CreateDataSet;\n\n    cds.Append;\n    cds.FieldByName('Value').AsString := 'Ezequiel Juliano';\n    cds.Post;\n\n    jo := TConverter.New.DataSet(cds).AsJSONObject;\n    try\n      CheckEqualsString(JSON, jo.ToString);\n    finally\n      jo.Free;\n    end;\n\n    jo := TJSONObject.ParseJSONValue(TEncoding.ASCII.GetBytes(JSON), 0) as TJSONObject;\n    try\n      TConverter.New.JSON(jo).ToDataSet(cds);\n      CheckFalse(cds.IsEmpty);\n      CheckTrue(cds.FieldByName('Value').AsString = 'Ezequiel Juliano');\n    finally\n      jo.Free;\n    end;\n  finally\n    cds.Free;\n  end;\nend;\n\nprocedure TTestsDataSetConverter.TestConvertDataSetToJSONBasic;\nconst\n  JSON_ARRAY_EMPTY = '[]';\n  JSON_OBJECT_EMPTY = '{}';\n  JSON_ARRAY =\n    '[{\"Id\":1,\"Name\":\"Customers 1\",\"Birth\":\"2014-01-22 14:05:03\"},' +\n    '{\"Id\":2,\"Name\":\"Customers 2\",\"Birth\":\"2014-01-22 14:05:03\"}]';\n  JSON_OBJECT =\n    '{\"Id\":2,\"Name\":\"Customers 2\",\"Birth\":\"2014-01-22 14:05:03\"}';\nvar\n  ja: TJSONArray;\n  jo: TJSONObject;\nbegin\n  fCdsCustomers.DataSetField := nil;\n  fCdsCustomers.CreateDataSet;\n\n  CheckEqualsString(JSON_ARRAY_EMPTY, fCdsCustomers.AsJSONArrayString);\n  CheckEqualsString(JSON_OBJECT_EMPTY, fCdsCustomers.AsJSONObjectString);\n\n  fCdsCustomers.Append;\n  fCdsCustomers.FieldByName('Id').AsInteger := 1;\n  fCdsCustomers.FieldByName('Name').AsString := 'Customers 1';\n  fCdsCustomers.FieldByName('Birth').AsDateTime := StrToDateTime('22/01/2014 14:05:03');\n  fCdsCustomers.Post;\n\n  fCdsCustomers.Append;\n  fCdsCustomers.FieldByName('Id').AsInteger := 2;\n  fCdsCustomers.FieldByName('Name').AsString := 'Customers 2';\n  fCdsCustomers.FieldByName('Birth').AsDateTime := StrToDateTime('22/01/2014 14:05:03');\n  fCdsCustomers.Post;\n\n  ja := TConverter.New.DataSet(fCdsCustomers).AsJSONArray;\n  CheckEqualsString(JSON_ARRAY, ja.ToString);\n\n  jo := TConverter.New.DataSet.Source(fCdsCustomers).AsJSONObject;\n  CheckEqualsString(JSON_OBJECT, jo.ToString);\n\n  ja.Free;\n  jo.Free;\nend;\n\nprocedure TTestsDataSetConverter.TestConvertDataSetToJSONBasicHelper;\nconst\n  JSON_ARRAY =\n    '[{\"Id\":1,\"Name\":\"Customers 1\",\"Birth\":\"2014-01-22 14:05:03\"},' +\n    '{\"Id\":2,\"Name\":\"Customers 2\",\"Birth\":\"2014-01-22 14:05:03\"}]';\n  JSON_OBJECT =\n    '{\"Id\":2,\"Name\":\"Customers 2\",\"Birth\":\"2014-01-22 14:05:03\"}';\nvar\n  ja: TJSONArray;\n  jo: TJSONObject;\nbegin\n  fCdsCustomers.DataSetField := nil;\n  fCdsCustomers.CreateDataSet;\n\n  fCdsCustomers.Append;\n  fCdsCustomers.FieldByName('Id').AsInteger := 1;\n  fCdsCustomers.FieldByName('Name').AsString := 'Customers 1';\n  fCdsCustomers.FieldByName('Birth').AsDateTime := StrToDateTime('22/01/2014 14:05:03');\n  fCdsCustomers.Post;\n\n  fCdsCustomers.Append;\n  fCdsCustomers.FieldByName('Id').AsInteger := 2;\n  fCdsCustomers.FieldByName('Name').AsString := 'Customers 2';\n  fCdsCustomers.FieldByName('Birth').AsDateTime := StrToDateTime('22/01/2014 14:05:03');\n  fCdsCustomers.Post;\n\n  ja := fCdsCustomers.AsJSONArray;\n  CheckEqualsString(JSON_ARRAY, ja.ToString);\n\n  jo := fCdsCustomers.AsJSONObject;\n  CheckEqualsString(JSON_OBJECT, jo.ToString);\n\n  ja.Free;\n  jo.Free;\nend;\n\nprocedure TTestsDataSetConverter.TestConvertDataSetToJSONBasicInvisibleFields;\nconst\n  JSON_ARRAY =\n    '[{\"Id\":1,\"Birth\":\"2014-01-22 14:05:03\"},' +\n    '{\"Id\":2,\"Birth\":\"2014-01-22 14:05:03\"}]';\n  JSON_OBJECT =\n    '{\"Id\":2,\"Birth\":\"2014-01-22 14:05:03\"}';\nvar\n  ja: TJSONArray;\n  jo: TJSONObject;\nbegin\n  fCdsCustomers.DataSetField := nil;\n  fCdsCustomers.CreateDataSet;\n\n  fCdsCustomers.FieldByName('Name').Visible := False;\n\n  fCdsCustomers.Append;\n  fCdsCustomers.FieldByName('Id').AsInteger := 1;\n  fCdsCustomers.FieldByName('Name').AsString := 'Customers 1';\n  fCdsCustomers.FieldByName('Birth').AsDateTime := StrToDateTime('22/01/2014 14:05:03');\n  fCdsCustomers.Post;\n\n  fCdsCustomers.Append;\n  fCdsCustomers.FieldByName('Id').AsInteger := 2;\n  fCdsCustomers.FieldByName('Name').AsString := 'Customers 2';\n  fCdsCustomers.FieldByName('Birth').AsDateTime := StrToDateTime('22/01/2014 14:05:03');\n  fCdsCustomers.Post;\n\n  ja := TConverter.New.DataSet(fCdsCustomers).AsJSONArray;\n  CheckEqualsString(JSON_ARRAY, ja.ToString);\n\n  jo := TConverter.New.DataSet.Source(fCdsCustomers).AsJSONObject;\n  CheckEqualsString(JSON_OBJECT, jo.ToString);\n\n  ja.Free;\n  jo.Free;\nend;\n\nprocedure TTestsDataSetConverter.TestConvertDataSetToJSONComplex;\nconst\n  JSON =\n    '{\"Id\":1,\"Description\":\"Sales 1\",\"Date\":\"2014-01-22\",\"Time\":\"14:03:03\",' +\n    '\"Customers\":{\"Id\":2,\"Name\":\"Customers 2\",\"Birth\":\"2014-01-22 14:05:03\"},' +\n    '\"Products\":[{\"Id\":1,\"Description\":\"Product 1\",\"Value\":100},' +\n    '{\"Id\":2,\"Description\":\"Product 2\",\"Value\":200.123456789}]}';\nvar\n  jo: TJSONObject;\nbegin\n  fCdsSales.Append;\n  fCdsSales.FieldByName('Id').AsInteger := 1;\n  fCdsSales.FieldByName('Description').AsString := 'Sales 1';\n  fCdsSales.FieldByName('Date').AsDateTime := StrToDate('22/01/2014');\n  fCdsSales.FieldByName('Time').AsDateTime := StrToTime('14:03:03');\n\n  fCdsCustomers.Append;\n  fCdsCustomers.FieldByName('Id').AsInteger := 2;\n  fCdsCustomers.FieldByName('Name').AsString := 'Customers 2';\n  fCdsCustomers.FieldByName('Birth').AsDateTime := StrToDateTime('22/01/2014 14:05:03');\n  fCdsCustomers.Post;\n\n  fCdsProducts.Append;\n  fCdsProducts.FieldByName('Id').AsInteger := 1;\n  fCdsProducts.FieldByName('Description').AsString := 'Product 1';\n  fCdsProducts.FieldByName('Value').AsFloat := 100;\n  fCdsProducts.Post;\n\n  fCdsProducts.Append;\n  fCdsProducts.FieldByName('Id').AsInteger := 2;\n  fCdsProducts.FieldByName('Description').AsString := 'Product 2';\n  fCdsProducts.FieldByName('Value').AsFloat := 200.123456789;\n  fCdsProducts.Post;\n\n  fCdsSales.Post;\n\n  jo := TConverter.New.DataSet(fCdsSales).AsJSONObject;\n  CheckEqualsString(JSON, jo.ToString);\n\n  jo.Free;\nend;\n\nprocedure TTestsDataSetConverter.TestConvertJSONToDataSetBasic;\nconst\n  JSON_ARRAY =\n    '[{\"Id\":1,\"Name\":\"Customers 1\",\"Birth\":\"2014-01-22 14:05:03\"},' +\n    '{\"Id\":2,\"Name\":\"Customers 2\",\"Birth\":\"2014-01-22 14:05:03\"}]';\n  JSON_OBJECT =\n    '{\"Id\":2,\"Name\":\"Customers 2\",\"Birth\":\"2014-01-22 14:05:03\"}';\nvar\n  ja: TJSONArray;\n  jo: TJSONObject;\nbegin\n  fCdsCustomers.DataSetField := nil;\n  fCdsCustomers.CreateDataSet;\n\n  ja := TJSONObject.ParseJSONValue(TEncoding.ASCII.GetBytes(JSON_ARRAY), 0) as TJSONArray;\n  jo := TJSONObject.ParseJSONValue(TEncoding.ASCII.GetBytes(JSON_OBJECT), 0) as TJSONObject;\n\n  TConverter.New.JSON(jo).ToDataSet(fCdsCustomers);\n  CheckFalse(fCdsCustomers.IsEmpty);\n\n  fCdsCustomers.EmptyDataSet;\n\n  TConverter.New.JSON.Source(ja).ToDataSet(fCdsCustomers);\n  CheckFalse(fCdsCustomers.IsEmpty);\n\n  ja.Free;\n  jo.Free;\nend;\n\nprocedure TTestsDataSetConverter.TestConvertJSONToDataSetComplex;\nconst\n  JSON =\n    '{\"Id\":1,\"Description\":\"Sales 1\",\"Date\":\"2014-01-22\",\"Time\":\"14:03:03\",' +\n    '\"Customers\":{\"Id\":2,\"Name\":\"Customers 2\",\"Birth\":\"2014-01-22 14:05:03\"},' +\n    '\"Products\":[{\"Id\":1,\"Description\":\"Product 1\",\"Value\":100},' +\n    '{\"Id\":2,\"Description\":\"Product 2\",\"Value\":200}]}';\nvar\n  jo: TJSONObject;\nbegin\n  jo := TJSONObject.ParseJSONValue(TEncoding.ASCII.GetBytes(JSON), 0) as TJSONObject;\n\n  TConverter.New.JSON(jo).ToDataSet(fCdsSales);\n\n  CheckFalse(fCdsSales.IsEmpty);\n  CheckFalse(fCdsCustomers.IsEmpty);\n  CheckFalse(fCdsProducts.IsEmpty);\n\n  jo.Free;\nend;\n\nprocedure TTestsDataSetConverter.TestConvertJSONToDataSetOwnsObject;\nconst\n  JSON_ARRAY =\n    '[{\"Id\":1,\"Name\":\"Customers 1\",\"Birth\":\"2014-01-22 14:05:03\"},' +\n    '{\"Id\":2,\"Name\":\"Customers 2\",\"Birth\":\"2014-01-22 14:05:03\"}]';\nvar\n  ja: TJSONArray;\nbegin\n  fCdsCustomers.DataSetField := nil;\n  fCdsCustomers.CreateDataSet;\n\n  ja := TJSONObject.ParseJSONValue(TEncoding.ASCII.GetBytes(JSON_ARRAY), 0) as TJSONArray;\n\n  TConverter.New.JSON.Source(ja, True).ToDataSet(fCdsCustomers);\n  CheckFalse(fCdsCustomers.IsEmpty);\nend;\n\nprocedure TTestsDataSetConverter.TestConvertJSONToStructure;\nconst\n  JSON = '[{' +\n    '\"FieldName\":\"Id\",' +\n    '\"DataType\":\"ftInteger\",' +\n    '\"Size\":0' +\n    '},{' +\n    '\"FieldName\":\"Description\",' +\n    '\"DataType\":\"ftString\",' +\n    '\"Size\":100' +\n    '},{' +\n    '\"FieldName\":\"Value\",' +\n    '\"DataType\":\"ftFloat\",' +\n    '\"Size\":0' +\n    '}]';\nvar\n  cds: TClientDataSet;\n  ja: TJSONArray;\nbegin\n  cds := TClientDataSet.Create(nil);\n  try\n    ja := TJSONObject.ParseJSONValue(TEncoding.ASCII.GetBytes(JSON), 0) as TJSONArray;\n    try\n      TConverter.New.JSON(ja).ToStructure(cds);\n      cds.CreateDataSet;\n\n      CheckTrue(cds.Fields[0].FieldName = 'Id');\n      CheckTrue(cds.Fields[0].DataType = ftInteger);\n      CheckTrue(cds.Fields[0].Size = 0);\n\n      CheckTrue(cds.Fields[1].FieldName = 'Description');\n      CheckTrue(cds.Fields[1].DataType = ftString);\n      CheckTrue(cds.Fields[1].Size = 100);\n\n      CheckTrue(cds.Fields[2].FieldName = 'Value');\n      CheckTrue(cds.Fields[2].DataType = ftFloat);\n      CheckTrue(cds.Fields[2].Size = 0);\n    finally\n      ja.Free;\n    end;\n  finally\n    cds.Free;\n  end;\nend;\n\nprocedure TTestsDataSetConverter.TestJSONConverter;\nconst\n  JSON_1 =\n    '[{\"Id\":1,\"Description\":\"Sales 1\",\"Date\":\"2014-01-22\",\"Time\":\"14:03:03\",' +\n    '\"Customers\":{\"Id\":2,\"Name\":\"Customers 2\",\"Birth\":\"2014-01-22 14:05:03\"},' +\n    '\"Products\":[{\"Id\":1,\"Description\":\"Product 1\",\"Value\":100},' +\n    '{\"Id\":2,\"Description\":\"Product 2\",\"Value\":200}]},' +\n    '{\"Id\":2,\"Description\":\"Sales 2\",\"Date\":\"2014-01-22\",\"Time\":\"14:03:03\",' +\n    '\"Customers\":{\"Id\":2,\"Name\":\"Customers 2\",\"Birth\":\"2014-01-22 14:05:03\"},' +\n    '\"Products\":[{\"Id\":1,\"Description\":\"Product 1\",\"Value\":100}]}]';\n\n  JSON_2 = '{\"Id\":3,\"Description\":\"Sales 3\",\"Date\":\"2014-01-22\",\"Time\":\"14:03:03\",' +\n    '\"Customers\":{\"Id\":2,\"Name\":\"Customers 2\",\"Birth\":\"2014-01-22 14:05:03\"},' +\n    '\"Products\":[{\"Id\":100,\"Description\":\"Product 100\",\"Value\":100},' +\n    '{\"Id\":200,\"Description\":\"Product 200\",\"Value\":200}]}';\nvar\n  converter: IJSONConverter;\n  ja: TJSONArray;\n  jo: TJSONObject;\nbegin\n  converter := TJSONConverter.Create;\n  ja := TJSONObject.ParseJSONValue(TEncoding.ASCII.GetBytes(JSON_1), 0) as TJSONArray;\n  try\n    converter.Source(ja).ToDataSet(fCdsSales);\n\n    fCdsSales.Last;\n\n    CheckTrue(fCdsSales.RecordCount = 2);\n    CheckTrue(fCdsCustomers.RecordCount = 1);\n    CheckTrue(fCdsProducts.RecordCount = 1);\n\n    jo := TJSONObject.ParseJSONValue(TEncoding.ASCII.GetBytes(JSON_2), 0) as TJSONObject;\n    try\n      converter.Source(jo).ToRecord(fCdsSales);\n      CheckTrue(fCdsSales.RecordCount = 2);\n      CheckTrue(fCdsCustomers.RecordCount = 1);\n      CheckTrue(fCdsProducts.RecordCount = 2);\n      CheckEquals('3', fCdsSales.FieldByName('Id').AsString);\n      CheckEquals('Sales 3', fCdsSales.FieldByName('Description').AsString);\n\n      fCdsProducts.First;\n      while not fCdsProducts.Eof do\n      begin\n        if (fCdsProducts.RecNo = 1) then\n        begin\n          CheckEquals('100', fCdsProducts.FieldByName('Id').AsString);\n          CheckEquals('Product 100', fCdsProducts.FieldByName('Description').AsString);\n        end\n        else if (fCdsProducts.RecNo = 2) then\n        begin\n          CheckEquals('200', fCdsProducts.FieldByName('Id').AsString);\n          CheckEquals('Product 200', fCdsProducts.FieldByName('Description').AsString);\n        end;\n        fCdsProducts.Next;\n      end;\n    finally\n      jo.Free;\n    end;\n  finally\n    ja.Free;\n  end;\nend;\n\nprocedure TTestsDataSetConverter.TestConvertStructureToJSON;\nconst\n  JSON_EMPTY = '[]';\n\n  JSON = '[{' +\n    '\"FieldName\":\"Id\",' +\n    '\"DataType\":\"ftInteger\",' +\n    '\"Size\":0' +\n    '},{' +\n    '\"FieldName\":\"Description\",' +\n    '\"DataType\":\"ftString\",' +\n    '\"Size\":100' +\n    '},{' +\n    '\"FieldName\":\"Value\",' +\n    '\"DataType\":\"ftFloat\",' +\n    '\"Size\":0' +\n    '}]';\nvar\n  cds: TClientDataSet;\n  ja: TJSONArray;\nbegin\n  cds := TClientDataSet.Create(nil);\n  try\n    ja := TConverter.New.DataSet(cds).AsJSONStructure;\n    try\n      CheckEqualsString(JSON_EMPTY, ja.ToString);\n    finally\n      ja.Free;\n    end;\n\n    NewDataSetField(cds, ftInteger, 'Id');\n    NewDataSetField(cds, ftString, 'Description', 100);\n    NewDataSetField(cds, ftFloat, 'Value');\n    cds.CreateDataSet;\n\n    ja := TConverter.New.DataSet(cds).AsJSONStructure;\n    try\n      CheckEqualsString(JSON, ja.ToString);\n    finally\n      ja.Free;\n    end;\n  finally\n    cds.Free;\n  end;\nend;\n\nprocedure TTestsDataSetConverter.Test_Inssue_2;\n// https://github.com/ezequieljuliano/DataSetConverter4Delphi/issues/2\nconst\n  JSON = '{\"Value\":50}';\nvar\n  cds: TClientDataSet;\n  jo: TJSONObject;\nbegin\n  cds := TClientDataSet.Create(nil);\n  try\n    NewDataSetField(cds, ftBCD, 'Value');\n\n    cds.CreateDataSet;\n\n    cds.Append;\n    cds.FieldByName('Value').AsBCD := 50;\n    cds.Post;\n\n    jo := TConverter.New.DataSet(cds).AsJSONObject;\n    try\n      CheckEqualsString(JSON, jo.ToString);\n    finally\n      jo.Free;\n    end;\n\n    jo := TJSONObject.ParseJSONValue(TEncoding.ASCII.GetBytes(JSON), 0) as TJSONObject;\n    try\n      TConverter.New.JSON(jo).ToDataSet(cds);\n      CheckFalse(cds.IsEmpty);\n      CheckTrue(cds.FieldByName('Value').AsBCD = 50);\n    finally\n      jo.Free;\n    end;\n  finally\n    cds.Free;\n  end;\nend;\n\nprocedure TTestsDataSetConverter.Test_Inssue_7;\n// https://github.com/ezequieljuliano/DataSetConverter4Delphi/issues/7\nconst\n  JSON = '{\"Value\":\"2014-01-22 14:05:03\"}';\nvar\n  cds: TClientDataSet;\n  jo: TJSONObject;\nbegin\n  cds := TClientDataSet.Create(nil);\n  try\n    NewDataSetField(cds, ftTimeStamp, 'Value');\n\n    cds.CreateDataSet;\n\n    cds.Append;\n    cds.FieldByName('Value').AsDateTime := StrToDateTime('22/01/2014 14:05:03');\n    cds.Post;\n\n    jo := TConverter.New.DataSet(cds).AsJSONObject;\n    try\n      CheckEqualsString(JSON, jo.ToString);\n    finally\n      jo.Free;\n    end;\n\n    jo := TJSONObject.ParseJSONValue(TEncoding.ASCII.GetBytes(JSON), 0) as TJSONObject;\n    try\n      TConverter.New.JSON(jo).ToDataSet(cds);\n      CheckFalse(cds.IsEmpty);\n      CheckTrue(cds.FieldByName('Value').AsDateTime = StrToDateTime('22/01/2014 14:05:03'));\n    finally\n      jo.Free;\n    end;\n  finally\n    cds.Free;\n  end;\nend;\n\nprocedure TTestsDataSetConverter.TestConvertJsonToFDMemTable_PR_32;\nconst\n  JSON =\n    '{' +\n      '\"Structure\": [' +\n        '{' +\n          '\"FieldName\": \"Id\",' +\n          '\"DataType\": \"ftInteger\",' +\n          '\"Size\": 0' +\n        '},{' +\n          '\"FieldName\": \"Description\",' +\n          '\"DataType\": \"ftString\",' +\n          '\"Size\": 100' +\n        '},{' +\n          '\"FieldName\": \"Value\",' +\n          '\"DataType\": \"ftBCD\",' +\n          '\"Size\": 2' +\n        '}' +\n      '],' +\n      '\"Products\": [' +\n        '{' +\n          '\"Id\": 1,' +\n          '\"Description\": \"Product 1\",' +\n          '\"Value\": 100.12' +\n        '},{' +\n          '\"Id\": 2,' +\n          '\"Description\": \"Product 2\",' +\n          '\"Value\": 200' +\n        '}' +\n      ']' +\n    '}';\nvar\n  jo: TJSONObject;\n  cds: TClientDataSet;\nbegin\n  cds := TClientDataSet.Create(nil);\n  try\n    jo := TJSONObject.ParseJSONValue(TEncoding.UTF8.GetBytes(JSON), 0) as TJSONObject;\n    try\n      cds.Close;\n      cds.Fields.Clear;\n      TConverter.New.JSON(\n        jo.Values['Structure'].AsType<TJSONArray>).ToStructure(cds);\n      cds.CreateDataSet;\n      cds.Open;\n      CheckException(\n        procedure\n        begin\n          TConverter.New.JSON(jo.Values['Products'].AsType<TJSONArray>).ToDataSet(cds)\n        end, nil);\n      cds.First;\n      while not cds.Eof do\n      begin\n        if (cds.RecNo = 1) then\n          CheckEquals(100.12, cds.FieldByName('Value').AsFloat, 2)\n        else if (cds.RecNo = 2) then\n          CheckEquals(200, cds.FieldByName('Value').AsFloat);\n        cds.Next;\n      end;\n    finally\n      jo.Free;\n    end;\n  finally\n    cds.Close;\n    cds.Free;\n  end;\nend;\n\ninitialization\n\nRegisterTest(TTestsDataSetConverter.Suite);\n\nend.\n"
  },
  {
    "path": "unittest/DataSetConverter4DTests.dpr",
    "content": "program DataSetConverter4DTests;\n{\n\n  Delphi DUnit Test Project\n  -------------------------\n  This project contains the DUnit test framework and the GUI/Console test runners.\n  Add \"CONSOLE_TESTRUNNER\" to the conditional defines entry in the project options\n  to use the console test runner.  Otherwise the GUI test runner will be used by\n  default.\n\n}\n\n{$IFDEF CONSOLE_TESTRUNNER}\n{$APPTYPE CONSOLE}\n{$ENDIF}\n\nuses\n  DUnitTestRunner,\n  DataSetConverter4D in '..\\src\\DataSetConverter4D.pas',\n  DataSetConverter4D.UnitTest in 'DataSetConverter4D.UnitTest.pas',\n  DataSetConverter4D.Impl in '..\\src\\DataSetConverter4D.Impl.pas',\n  DataSetConverter4D.Util in '..\\src\\DataSetConverter4D.Util.pas',\n  DataSetConverter4D.Helper in '..\\src\\DataSetConverter4D.Helper.pas';\n\n{$R *.RES}\n\nbegin\n\n  ReportMemoryLeaksOnShutdown := True;\n\n  DUnitTestRunner.RunRegisteredTests;\n\nend.\n"
  },
  {
    "path": "unittest/DataSetConverter4DTests.dproj",
    "content": "﻿<Project xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n    <PropertyGroup>\n        <ProjectGuid>{8707BA43-12EB-4235-A68B-515D30E96922}</ProjectGuid>\n        <ProjectVersion>18.4</ProjectVersion>\n        <FrameworkType>None</FrameworkType>\n        <Base>True</Base>\n        <Config Condition=\"'$(Config)'==''\">Debug</Config>\n        <Platform Condition=\"'$(Platform)'==''\">Win32</Platform>\n        <TargetedPlatforms>1</TargetedPlatforms>\n        <AppType>Console</AppType>\n        <MainSource>DataSetConverter4DTests.dpr</MainSource>\n    </PropertyGroup>\n    <PropertyGroup Condition=\"'$(Config)'=='Base' or '$(Base)'!=''\">\n        <Base>true</Base>\n    </PropertyGroup>\n    <PropertyGroup Condition=\"('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''\">\n        <Base_Win32>true</Base_Win32>\n        <CfgParent>Base</CfgParent>\n        <Base>true</Base>\n    </PropertyGroup>\n    <PropertyGroup Condition=\"('$(Platform)'=='Win64' and '$(Base)'=='true') or '$(Base_Win64)'!=''\">\n        <Base_Win64>true</Base_Win64>\n        <CfgParent>Base</CfgParent>\n        <Base>true</Base>\n    </PropertyGroup>\n    <PropertyGroup Condition=\"'$(Config)'=='Debug' or '$(Cfg_1)'!=''\">\n        <Cfg_1>true</Cfg_1>\n        <CfgParent>Base</CfgParent>\n        <Base>true</Base>\n    </PropertyGroup>\n    <PropertyGroup Condition=\"('$(Platform)'=='Win32' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win32)'!=''\">\n        <Cfg_1_Win32>true</Cfg_1_Win32>\n        <CfgParent>Cfg_1</CfgParent>\n        <Cfg_1>true</Cfg_1>\n        <Base>true</Base>\n    </PropertyGroup>\n    <PropertyGroup Condition=\"'$(Config)'=='Release' or '$(Cfg_2)'!=''\">\n        <Cfg_2>true</Cfg_2>\n        <CfgParent>Base</CfgParent>\n        <Base>true</Base>\n    </PropertyGroup>\n    <PropertyGroup Condition=\"'$(Base)'!=''\">\n        <Icon_MainIcon>$(BDS)\\bin\\delphi_PROJECTICON.ico</Icon_MainIcon>\n        <Icns_MainIcns>$(BDS)\\bin\\delphi_PROJECTICNS.icns</Icns_MainIcns>\n        <SanitizedProjectName>DataSetConverter4DTests</SanitizedProjectName>\n        <VerInfo_Locale>1046</VerInfo_Locale>\n        <DCC_BplOutput>.\\$(Platform)\\$(Config)\\pkg</DCC_BplOutput>\n        <DCC_DcpOutput>.\\$(Platform)\\$(Config)\\dcp</DCC_DcpOutput>\n        <VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>\n        <Manifest_File>None</Manifest_File>\n        <DCC_Define>_CONSOLE_TESTRUNNER;$(DCC_Define)</DCC_Define>\n        <DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace)</DCC_Namespace>\n        <DCC_UnitSearchPath>$(BDS)\\Source\\DUnit\\src;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>\n        <DCC_DcuOutput>.\\$(Platform)\\$(Config)\\dcu</DCC_DcuOutput>\n        <DCC_ExeOutput>.\\$(Platform)\\$(Config)</DCC_ExeOutput>\n        <DCC_E>false</DCC_E>\n        <DCC_N>false</DCC_N>\n        <DCC_S>false</DCC_S>\n        <DCC_F>false</DCC_F>\n        <DCC_K>false</DCC_K>\n    </PropertyGroup>\n    <PropertyGroup Condition=\"'$(Base_Win32)'!=''\">\n        <VerInfo_Locale>1033</VerInfo_Locale>\n        <DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>\n        <DCC_UsePackage>IndyIPClient;FireDACASADriver;FireDACSqliteDriver;bindcompfmx;DBXSqliteDriver;vcldbx;FireDACPgDriver;FireDACODBCDriver;fmx;rtl;dbrtl;DbxClientDriver;IndySystem;FireDACCommon;bindcomp;inetdb;TeeDB;inetdbbde;vclib;DBXInterBaseDriver;DataSnapClient;DataSnapCommon;DBXOdbcDriver;DataSnapServer;Tee;vclFireDAC;DataSnapProviderClient;xmlrtl;DBXSybaseASEDriver;ibxpress;DbxCommonDriver;svnui;vclimg;IndyProtocols;DBXMySQLDriver;dbxcds;DatasnapConnectorsFreePascal;FireDACCommonDriver;MetropolisUILiveTile;bindengine;vclactnband;vcldb;bindcompdbx;FMXTee;vcldsnap;bindcompvcl;soaprtl;TeeUI;vclie;fmxFireDAC;FireDACADSDriver;DBXDb2Driver;vcltouch;DBXOracleDriver;CustomIPTransport;vclribbon;VCLRESTComponents;dsnap;DBXInformixDriver;FireDAC;FireDACMSSQLDriver;fmxase;vcl;DataSnapConnectors;FireDACDataSnapDriver;IndyCore;DBXMSSQLDriver;CloudService;Intraweb;DBXFirebirdDriver;FireDACIBDriver;FmxTeeUI;inet;IndyIPCommon;fmxobj;FireDACDBXDriver;IndyIPServer;dsnapcon;FireDACMySQLDriver;VclSmp;vclx;inetdbxpress;svn;DBXSybaseASADriver;FireDACOracleDriver;fmxdae;FireDACDb2Driver;RESTComponents;bdertl;FireDACMSAccDriver;dbexpress;adortl;DataSnapIndy10ServerTransport;$(DCC_UsePackage)</DCC_UsePackage>\n        <VerInfo_Keys>CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(ModuleName);FileDescription=$(ModuleName);ProductName=$(ModuleName)</VerInfo_Keys>\n    </PropertyGroup>\n    <PropertyGroup Condition=\"'$(Base_Win64)'!=''\">\n        <DCC_UsePackage>IndyIPClient;FireDACASADriver;FireDACSqliteDriver;bindcompfmx;DBXSqliteDriver;FireDACPgDriver;FireDACODBCDriver;fmx;rtl;dbrtl;DbxClientDriver;IndySystem;FireDACCommon;bindcomp;inetdb;TeeDB;vclib;DBXInterBaseDriver;DataSnapClient;DataSnapCommon;DBXOdbcDriver;DataSnapServer;Tee;vclFireDAC;DataSnapProviderClient;xmlrtl;DBXSybaseASEDriver;ibxpress;DbxCommonDriver;vclimg;IndyProtocols;DBXMySQLDriver;dbxcds;DatasnapConnectorsFreePascal;FireDACCommonDriver;MetropolisUILiveTile;bindengine;vclactnband;vcldb;bindcompdbx;FMXTee;vcldsnap;bindcompvcl;soaprtl;TeeUI;vclie;fmxFireDAC;FireDACADSDriver;DBXDb2Driver;vcltouch;DBXOracleDriver;CustomIPTransport;vclribbon;VCLRESTComponents;dsnap;DBXInformixDriver;FireDAC;FireDACMSSQLDriver;fmxase;vcl;DataSnapConnectors;FireDACDataSnapDriver;IndyCore;DBXMSSQLDriver;CloudService;Intraweb;DBXFirebirdDriver;FireDACIBDriver;FmxTeeUI;inet;IndyIPCommon;fmxobj;FireDACDBXDriver;IndyIPServer;dsnapcon;FireDACMySQLDriver;VclSmp;vclx;inetdbxpress;DBXSybaseASADriver;FireDACOracleDriver;fmxdae;FireDACDb2Driver;RESTComponents;FireDACMSAccDriver;dbexpress;adortl;DataSnapIndy10ServerTransport;$(DCC_UsePackage)</DCC_UsePackage>\n    </PropertyGroup>\n    <PropertyGroup Condition=\"'$(Cfg_1)'!=''\">\n        <DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>\n        <DCC_DebugDCUs>true</DCC_DebugDCUs>\n        <DCC_Optimize>false</DCC_Optimize>\n        <DCC_GenerateStackFrames>true</DCC_GenerateStackFrames>\n        <DCC_DebugInfoInExe>true</DCC_DebugInfoInExe>\n        <DCC_RemoteDebug>true</DCC_RemoteDebug>\n    </PropertyGroup>\n    <PropertyGroup Condition=\"'$(Cfg_1_Win32)'!=''\">\n        <VerInfo_Locale>1033</VerInfo_Locale>\n        <DCC_RemoteDebug>false</DCC_RemoteDebug>\n    </PropertyGroup>\n    <PropertyGroup Condition=\"'$(Cfg_2)'!=''\">\n        <DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>\n        <DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>\n        <DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>\n        <DCC_DebugInformation>0</DCC_DebugInformation>\n    </PropertyGroup>\n    <ItemGroup>\n        <DelphiCompile Include=\"$(MainSource)\">\n            <MainSource>MainSource</MainSource>\n        </DelphiCompile>\n        <DCCReference Include=\"..\\src\\DataSetConverter4D.pas\"/>\n        <DCCReference Include=\"DataSetConverter4D.UnitTest.pas\"/>\n        <DCCReference Include=\"..\\src\\DataSetConverter4D.Impl.pas\"/>\n        <DCCReference Include=\"..\\src\\DataSetConverter4D.Util.pas\"/>\n        <DCCReference Include=\"..\\src\\DataSetConverter4D.Helper.pas\"/>\n        <BuildConfiguration Include=\"Release\">\n            <Key>Cfg_2</Key>\n            <CfgParent>Base</CfgParent>\n        </BuildConfiguration>\n        <BuildConfiguration Include=\"Base\">\n            <Key>Base</Key>\n        </BuildConfiguration>\n        <BuildConfiguration Include=\"Debug\">\n            <Key>Cfg_1</Key>\n            <CfgParent>Base</CfgParent>\n        </BuildConfiguration>\n    </ItemGroup>\n    <ProjectExtensions>\n        <Borland.Personality>Delphi.Personality.12</Borland.Personality>\n        <Borland.ProjectType/>\n        <BorlandProject>\n            <Delphi.Personality>\n                <VersionInfo>\n                    <VersionInfo Name=\"IncludeVerInfo\">False</VersionInfo>\n                    <VersionInfo Name=\"AutoIncBuild\">False</VersionInfo>\n                    <VersionInfo Name=\"MajorVer\">1</VersionInfo>\n                    <VersionInfo Name=\"MinorVer\">0</VersionInfo>\n                    <VersionInfo Name=\"Release\">0</VersionInfo>\n                    <VersionInfo Name=\"Build\">0</VersionInfo>\n                    <VersionInfo Name=\"Debug\">False</VersionInfo>\n                    <VersionInfo Name=\"PreRelease\">False</VersionInfo>\n                    <VersionInfo Name=\"Special\">False</VersionInfo>\n                    <VersionInfo Name=\"Private\">False</VersionInfo>\n                    <VersionInfo Name=\"DLL\">False</VersionInfo>\n                    <VersionInfo Name=\"Locale\">1046</VersionInfo>\n                    <VersionInfo Name=\"CodePage\">1252</VersionInfo>\n                </VersionInfo>\n                <VersionInfoKeys>\n                    <VersionInfoKeys Name=\"CompanyName\"/>\n                    <VersionInfoKeys Name=\"FileDescription\"/>\n                    <VersionInfoKeys Name=\"FileVersion\">1.0.0.0</VersionInfoKeys>\n                    <VersionInfoKeys Name=\"InternalName\"/>\n                    <VersionInfoKeys Name=\"LegalCopyright\"/>\n                    <VersionInfoKeys Name=\"LegalTrademarks\"/>\n                    <VersionInfoKeys Name=\"OriginalFilename\"/>\n                    <VersionInfoKeys Name=\"ProductName\"/>\n                    <VersionInfoKeys Name=\"ProductVersion\">1.0.0.0</VersionInfoKeys>\n                    <VersionInfoKeys Name=\"Comments\"/>\n                    <VersionInfoKeys Name=\"CFBundleName\"/>\n                    <VersionInfoKeys Name=\"CFBundleDisplayName\"/>\n                    <VersionInfoKeys Name=\"UIDeviceFamily\"/>\n                    <VersionInfoKeys Name=\"CFBundleIdentifier\"/>\n                    <VersionInfoKeys Name=\"CFBundleVersion\"/>\n                    <VersionInfoKeys Name=\"CFBundlePackageType\"/>\n                    <VersionInfoKeys Name=\"CFBundleSignature\"/>\n                    <VersionInfoKeys Name=\"CFBundleAllowMixedLocalizations\"/>\n                    <VersionInfoKeys Name=\"UISupportedInterfaceOrientations\"/>\n                    <VersionInfoKeys Name=\"CFBundleExecutable\"/>\n                    <VersionInfoKeys Name=\"CFBundleResourceSpecification\"/>\n                    <VersionInfoKeys Name=\"LSRequiresIPhoneOS\"/>\n                    <VersionInfoKeys Name=\"CFBundleInfoDictionaryVersion\"/>\n                    <VersionInfoKeys Name=\"CFBundleDevelopmentRegion\"/>\n                    <VersionInfoKeys Name=\"package\"/>\n                    <VersionInfoKeys Name=\"label\"/>\n                    <VersionInfoKeys Name=\"versionCode\"/>\n                    <VersionInfoKeys Name=\"versionName\"/>\n                    <VersionInfoKeys Name=\"persistent\"/>\n                    <VersionInfoKeys Name=\"restoreAnyVersion\"/>\n                    <VersionInfoKeys Name=\"installLocation\"/>\n                    <VersionInfoKeys Name=\"largeHeap\"/>\n                    <VersionInfoKeys Name=\"theme\"/>\n                </VersionInfoKeys>\n                <Source>\n                    <Source Name=\"MainSource\">DataSetConverter4DTests.dpr</Source>\n                </Source>\n                <Excluded_Packages>\n                    <Excluded_Packages Name=\"$(BDSBIN)\\dcloffice2k210.bpl\">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>\n                    <Excluded_Packages Name=\"$(BDSBIN)\\dclofficexp210.bpl\">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>\n                </Excluded_Packages>\n            </Delphi.Personality>\n            <Deployment Version=\"3\">\n                <DeployFile LocalName=\"$(BDS)\\Redist\\iossimulator\\libcgunwind.1.0.dylib\" Class=\"DependencyModule\"/>\n                <DeployFile LocalName=\"$(BDS)\\Redist\\osx32\\libcgunwind.1.0.dylib\" Class=\"DependencyModule\">\n                    <Platform Name=\"OSX32\">\n                        <Overwrite>true</Overwrite>\n                    </Platform>\n                </DeployFile>\n                <DeployFile LocalName=\"$(BDS)\\Redist\\osx32\\libcgunwind.1.0.dylib\" Class=\"DependencyModule\"/>\n                <DeployFile LocalName=\"Win32\\Debug\\DataSetConverter4DTests.exe\" Configuration=\"Debug\" Class=\"ProjectOutput\">\n                    <Platform Name=\"Win32\">\n                        <RemoteName>DataSetConverter4DTests.exe</RemoteName>\n                        <Overwrite>true</Overwrite>\n                    </Platform>\n                </DeployFile>\n                <DeployFile LocalName=\"$(BDS)\\Redist\\iossimulator\\libPCRE.dylib\" Class=\"DependencyModule\">\n                    <Platform Name=\"iOSSimulator\">\n                        <Overwrite>true</Overwrite>\n                    </Platform>\n                </DeployFile>\n                <DeployFile LocalName=\"$(BDS)\\Redist\\iossimulator\\libPCRE.dylib\" Class=\"DependencyModule\"/>\n                <DeployFile LocalName=\"$(BDS)\\Redist\\iossimulator\\libcgunwind.1.0.dylib\" Class=\"DependencyModule\">\n                    <Platform Name=\"iOSSimulator\">\n                        <Overwrite>true</Overwrite>\n                    </Platform>\n                </DeployFile>\n                <DeployFile LocalName=\"$(BDS)\\Redist\\osx32\\libcgsqlite3.dylib\" Class=\"DependencyModule\">\n                    <Platform Name=\"OSX32\">\n                        <Overwrite>true</Overwrite>\n                    </Platform>\n                </DeployFile>\n                <DeployClass Name=\"AdditionalDebugSymbols\">\n                    <Platform Name=\"OSX32\">\n                        <Operation>1</Operation>\n                    </Platform>\n                    <Platform Name=\"Win32\">\n                        <RemoteDir>Contents\\MacOS</RemoteDir>\n                        <Operation>0</Operation>\n                    </Platform>\n                </DeployClass>\n                <DeployClass Name=\"AndroidClassesDexFile\">\n                    <Platform Name=\"Android\">\n                        <RemoteDir>classes</RemoteDir>\n                        <Operation>1</Operation>\n                    </Platform>\n                </DeployClass>\n                <DeployClass Name=\"AndroidGDBServer\">\n                    <Platform Name=\"Android\">\n                        <RemoteDir>library\\lib\\armeabi-v7a</RemoteDir>\n                        <Operation>1</Operation>\n                    </Platform>\n                </DeployClass>\n                <DeployClass Name=\"AndroidLibnativeArmeabiFile\">\n                    <Platform Name=\"Android\">\n                        <RemoteDir>library\\lib\\armeabi</RemoteDir>\n                        <Operation>1</Operation>\n                    </Platform>\n                </DeployClass>\n                <DeployClass Name=\"AndroidLibnativeMipsFile\">\n                    <Platform Name=\"Android\">\n                        <RemoteDir>library\\lib\\mips</RemoteDir>\n                        <Operation>1</Operation>\n                    </Platform>\n                </DeployClass>\n                <DeployClass Name=\"AndroidLibnativeX86File\"/>\n                <DeployClass Name=\"AndroidServiceOutput\">\n                    <Platform Name=\"Android\">\n                        <RemoteDir>library\\lib\\armeabi-v7a</RemoteDir>\n                        <Operation>1</Operation>\n                    </Platform>\n                </DeployClass>\n                <DeployClass Name=\"AndroidSplashImageDef\">\n                    <Platform Name=\"Android\">\n                        <RemoteDir>res\\drawable</RemoteDir>\n                        <Operation>1</Operation>\n                    </Platform>\n                </DeployClass>\n                <DeployClass Name=\"AndroidSplashStyles\">\n                    <Platform Name=\"Android\">\n                        <RemoteDir>res\\values</RemoteDir>\n                        <Operation>1</Operation>\n                    </Platform>\n                </DeployClass>\n                <DeployClass Name=\"Android_DefaultAppIcon\">\n                    <Platform Name=\"Android\">\n                        <RemoteDir>res\\drawable</RemoteDir>\n                        <Operation>1</Operation>\n                    </Platform>\n                </DeployClass>\n                <DeployClass Name=\"Android_LauncherIcon144\">\n                    <Platform Name=\"Android\">\n                        <RemoteDir>res\\drawable-xxhdpi</RemoteDir>\n                        <Operation>1</Operation>\n                    </Platform>\n                </DeployClass>\n                <DeployClass Name=\"Android_LauncherIcon36\">\n                    <Platform Name=\"Android\">\n                        <RemoteDir>res\\drawable-ldpi</RemoteDir>\n                        <Operation>1</Operation>\n                    </Platform>\n                </DeployClass>\n                <DeployClass Name=\"Android_LauncherIcon48\">\n                    <Platform Name=\"Android\">\n                        <RemoteDir>res\\drawable-mdpi</RemoteDir>\n                        <Operation>1</Operation>\n                    </Platform>\n                </DeployClass>\n                <DeployClass Name=\"Android_LauncherIcon72\">\n                    <Platform Name=\"Android\">\n                        <RemoteDir>res\\drawable-hdpi</RemoteDir>\n                        <Operation>1</Operation>\n                    </Platform>\n                </DeployClass>\n                <DeployClass Name=\"Android_LauncherIcon96\">\n                    <Platform Name=\"Android\">\n                        <RemoteDir>res\\drawable-xhdpi</RemoteDir>\n                        <Operation>1</Operation>\n                    </Platform>\n                </DeployClass>\n                <DeployClass Name=\"Android_SplashImage426\">\n                    <Platform Name=\"Android\">\n                        <RemoteDir>res\\drawable-small</RemoteDir>\n                        <Operation>1</Operation>\n                    </Platform>\n                </DeployClass>\n                <DeployClass Name=\"Android_SplashImage470\">\n                    <Platform Name=\"Android\">\n                        <RemoteDir>res\\drawable-normal</RemoteDir>\n                        <Operation>1</Operation>\n                    </Platform>\n                </DeployClass>\n                <DeployClass Name=\"Android_SplashImage640\">\n                    <Platform Name=\"Android\">\n                        <RemoteDir>res\\drawable-large</RemoteDir>\n                        <Operation>1</Operation>\n                    </Platform>\n                </DeployClass>\n                <DeployClass Name=\"Android_SplashImage960\">\n                    <Platform Name=\"Android\">\n                        <RemoteDir>res\\drawable-xlarge</RemoteDir>\n                        <Operation>1</Operation>\n                    </Platform>\n                </DeployClass>\n                <DeployClass Name=\"DebugSymbols\">\n                    <Platform Name=\"iOSSimulator\">\n                        <Operation>1</Operation>\n                    </Platform>\n                    <Platform Name=\"OSX32\">\n                        <Operation>1</Operation>\n                    </Platform>\n                    <Platform Name=\"Win32\">\n                        <Operation>0</Operation>\n                    </Platform>\n                </DeployClass>\n                <DeployClass Name=\"DependencyFramework\">\n                    <Platform Name=\"OSX32\">\n                        <Operation>1</Operation>\n                        <Extensions>.framework</Extensions>\n                    </Platform>\n                    <Platform Name=\"Win32\">\n                        <Operation>0</Operation>\n                    </Platform>\n                </DeployClass>\n                <DeployClass Name=\"DependencyModule\">\n                    <Platform Name=\"OSX32\">\n                        <Operation>1</Operation>\n                        <Extensions>.dylib</Extensions>\n                    </Platform>\n                    <Platform Name=\"Win32\">\n                        <Operation>0</Operation>\n                        <Extensions>.dll;.bpl</Extensions>\n                    </Platform>\n                </DeployClass>\n                <DeployClass Required=\"true\" Name=\"DependencyPackage\">\n                    <Platform Name=\"iOSDevice32\">\n                        <Operation>1</Operation>\n                        <Extensions>.dylib</Extensions>\n                    </Platform>\n                    <Platform Name=\"iOSDevice64\">\n                        <Operation>1</Operation>\n                        <Extensions>.dylib</Extensions>\n                    </Platform>\n                    <Platform Name=\"iOSSimulator\">\n                        <Operation>1</Operation>\n                        <Extensions>.dylib</Extensions>\n                    </Platform>\n                    <Platform Name=\"OSX32\">\n                        <Operation>1</Operation>\n                        <Extensions>.dylib</Extensions>\n                    </Platform>\n                    <Platform Name=\"Win32\">\n                        <Operation>0</Operation>\n                        <Extensions>.bpl</Extensions>\n                    </Platform>\n                </DeployClass>\n                <DeployClass Name=\"File\">\n                    <Platform Name=\"Android\">\n                        <Operation>0</Operation>\n                    </Platform>\n                    <Platform Name=\"iOSDevice32\">\n                        <Operation>0</Operation>\n                    </Platform>\n                    <Platform Name=\"iOSDevice64\">\n                        <Operation>0</Operation>\n                    </Platform>\n                    <Platform Name=\"iOSSimulator\">\n                        <Operation>0</Operation>\n                    </Platform>\n                    <Platform Name=\"OSX32\">\n                        <Operation>0</Operation>\n                    </Platform>\n                    <Platform Name=\"Win32\">\n                        <Operation>0</Operation>\n                    </Platform>\n                </DeployClass>\n                <DeployClass Name=\"iPad_Launch1024\">\n                    <Platform Name=\"iOSDevice32\">\n                        <Operation>1</Operation>\n                    </Platform>\n                    <Platform Name=\"iOSDevice64\">\n                        <Operation>1</Operation>\n                    </Platform>\n                    <Platform Name=\"iOSSimulator\">\n                        <Operation>1</Operation>\n                    </Platform>\n                </DeployClass>\n                <DeployClass Name=\"iPad_Launch1536\">\n                    <Platform Name=\"iOSDevice32\">\n                        <Operation>1</Operation>\n                    </Platform>\n                    <Platform Name=\"iOSDevice64\">\n                        <Operation>1</Operation>\n                    </Platform>\n                    <Platform Name=\"iOSSimulator\">\n                        <Operation>1</Operation>\n                    </Platform>\n                </DeployClass>\n                <DeployClass Name=\"iPad_Launch2048\">\n                    <Platform Name=\"iOSDevice32\">\n                        <Operation>1</Operation>\n                    </Platform>\n                    <Platform Name=\"iOSDevice64\">\n                        <Operation>1</Operation>\n                    </Platform>\n                    <Platform Name=\"iOSSimulator\">\n                        <Operation>1</Operation>\n                    </Platform>\n                </DeployClass>\n                <DeployClass Name=\"iPad_Launch768\">\n                    <Platform Name=\"iOSDevice32\">\n                        <Operation>1</Operation>\n                    </Platform>\n                    <Platform Name=\"iOSDevice64\">\n                        <Operation>1</Operation>\n                    </Platform>\n                    <Platform Name=\"iOSSimulator\">\n                        <Operation>1</Operation>\n                    </Platform>\n                </DeployClass>\n                <DeployClass Name=\"iPhone_Launch320\">\n                    <Platform Name=\"iOSDevice32\">\n                        <Operation>1</Operation>\n                    </Platform>\n                    <Platform Name=\"iOSDevice64\">\n                        <Operation>1</Operation>\n                    </Platform>\n                    <Platform Name=\"iOSSimulator\">\n                        <Operation>1</Operation>\n                    </Platform>\n                </DeployClass>\n                <DeployClass Name=\"iPhone_Launch640\">\n                    <Platform Name=\"iOSDevice32\">\n                        <Operation>1</Operation>\n                    </Platform>\n                    <Platform Name=\"iOSDevice64\">\n                        <Operation>1</Operation>\n                    </Platform>\n                    <Platform Name=\"iOSSimulator\">\n                        <Operation>1</Operation>\n                    </Platform>\n                </DeployClass>\n                <DeployClass Name=\"iPhone_Launch640x1136\">\n                    <Platform Name=\"iOSDevice32\">\n                        <Operation>1</Operation>\n                    </Platform>\n                    <Platform Name=\"iOSDevice64\">\n                        <Operation>1</Operation>\n                    </Platform>\n                    <Platform Name=\"iOSSimulator\">\n                        <Operation>1</Operation>\n                    </Platform>\n                </DeployClass>\n                <DeployClass Name=\"ProjectAndroidManifest\">\n                    <Platform Name=\"Android\">\n                        <Operation>1</Operation>\n                    </Platform>\n                </DeployClass>\n                <DeployClass Name=\"ProjectiOSDeviceDebug\">\n                    <Platform Name=\"iOSDevice32\">\n                        <RemoteDir>..\\$(PROJECTNAME).app.dSYM\\Contents\\Resources\\DWARF</RemoteDir>\n                        <Operation>1</Operation>\n                    </Platform>\n                    <Platform Name=\"iOSDevice64\">\n                        <RemoteDir>..\\$(PROJECTNAME).app.dSYM\\Contents\\Resources\\DWARF</RemoteDir>\n                        <Operation>1</Operation>\n                    </Platform>\n                </DeployClass>\n                <DeployClass Name=\"ProjectiOSDeviceResourceRules\"/>\n                <DeployClass Name=\"ProjectiOSEntitlements\"/>\n                <DeployClass Name=\"ProjectiOSInfoPList\"/>\n                <DeployClass Name=\"ProjectiOSResource\">\n                    <Platform Name=\"iOSDevice32\">\n                        <Operation>1</Operation>\n                    </Platform>\n                    <Platform Name=\"iOSDevice64\">\n                        <Operation>1</Operation>\n                    </Platform>\n                    <Platform Name=\"iOSSimulator\">\n                        <Operation>1</Operation>\n                    </Platform>\n                </DeployClass>\n                <DeployClass Name=\"ProjectOSXEntitlements\"/>\n                <DeployClass Name=\"ProjectOSXInfoPList\"/>\n                <DeployClass Name=\"ProjectOSXResource\">\n                    <Platform Name=\"OSX32\">\n                        <RemoteDir>Contents\\Resources</RemoteDir>\n                        <Operation>1</Operation>\n                    </Platform>\n                </DeployClass>\n                <DeployClass Required=\"true\" Name=\"ProjectOutput\">\n                    <Platform Name=\"Android\">\n                        <RemoteDir>library\\lib\\armeabi-v7a</RemoteDir>\n                        <Operation>1</Operation>\n                    </Platform>\n                    <Platform Name=\"iOSDevice32\">\n                        <Operation>1</Operation>\n                    </Platform>\n                    <Platform Name=\"iOSDevice64\">\n                        <Operation>1</Operation>\n                    </Platform>\n                    <Platform Name=\"iOSSimulator\">\n                        <Operation>1</Operation>\n                    </Platform>\n                    <Platform Name=\"Linux64\">\n                        <Operation>1</Operation>\n                    </Platform>\n                    <Platform Name=\"OSX32\">\n                        <Operation>1</Operation>\n                    </Platform>\n                    <Platform Name=\"Win32\">\n                        <Operation>0</Operation>\n                    </Platform>\n                </DeployClass>\n                <DeployClass Name=\"ProjectUWPManifest\">\n                    <Platform Name=\"Win32\">\n                        <Operation>1</Operation>\n                    </Platform>\n                    <Platform Name=\"Win64\">\n                        <Operation>1</Operation>\n                    </Platform>\n                </DeployClass>\n                <DeployClass Name=\"UWP_DelphiLogo150\">\n                    <Platform Name=\"Win32\">\n                        <RemoteDir>Assets</RemoteDir>\n                        <Operation>1</Operation>\n                    </Platform>\n                    <Platform Name=\"Win64\">\n                        <RemoteDir>Assets</RemoteDir>\n                        <Operation>1</Operation>\n                    </Platform>\n                </DeployClass>\n                <DeployClass Name=\"UWP_DelphiLogo44\">\n                    <Platform Name=\"Win32\">\n                        <RemoteDir>Assets</RemoteDir>\n                        <Operation>1</Operation>\n                    </Platform>\n                    <Platform Name=\"Win64\">\n                        <RemoteDir>Assets</RemoteDir>\n                        <Operation>1</Operation>\n                    </Platform>\n                </DeployClass>\n                <ProjectRoot Platform=\"iOSDevice64\" Name=\"$(PROJECTNAME).app\"/>\n                <ProjectRoot Platform=\"Win64\" Name=\"$(PROJECTNAME)\"/>\n                <ProjectRoot Platform=\"iOSDevice32\" Name=\"$(PROJECTNAME).app\"/>\n                <ProjectRoot Platform=\"iOSDevice\" Name=\"$(PROJECTNAME).app\"/>\n                <ProjectRoot Platform=\"Win32\" Name=\"$(PROJECTNAME)\"/>\n                <ProjectRoot Platform=\"Linux64\" Name=\"$(PROJECTNAME)\"/>\n                <ProjectRoot Platform=\"OSX32\" Name=\"$(PROJECTNAME)\"/>\n                <ProjectRoot Platform=\"Android\" Name=\"$(PROJECTNAME)\"/>\n                <ProjectRoot Platform=\"iOSSimulator\" Name=\"$(PROJECTNAME).app\"/>\n            </Deployment>\n            <Platforms>\n                <Platform value=\"Linux64\">False</Platform>\n                <Platform value=\"Win32\">True</Platform>\n                <Platform value=\"Win64\">False</Platform>\n            </Platforms>\n            <UnitTesting>\n                <TestFramework>DUnit / Delphi Win32</TestFramework>\n                <TestRunner>GUI</TestRunner>\n                <TestProjectName/>\n                <SourceProjectName/>\n            </UnitTesting>\n        </BorlandProject>\n        <ProjectFileVersion>12</ProjectFileVersion>\n    </ProjectExtensions>\n    <Import Project=\"$(BDS)\\Bin\\CodeGear.Delphi.Targets\" Condition=\"Exists('$(BDS)\\Bin\\CodeGear.Delphi.Targets')\"/>\n    <Import Project=\"$(APPDATA)\\Embarcadero\\$(BDSAPPDATABASEDIR)\\$(PRODUCTVERSION)\\UserTools.proj\" Condition=\"Exists('$(APPDATA)\\Embarcadero\\$(BDSAPPDATABASEDIR)\\$(PRODUCTVERSION)\\UserTools.proj')\"/>\n    <Import Project=\"$(MSBuildProjectName).deployproj\" Condition=\"Exists('$(MSBuildProjectName).deployproj')\"/>\n</Project>\n"
  }
]