Jump to content

Search the Community

Showing results for tags 'json'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Delphi Questions and Answers
    • Algorithms, Data Structures and Class Design
    • VCL
    • FMX
    • RTL and Delphi Object Pascal
    • Databases
    • Network, Cloud and Web
    • Windows API
    • Cross-platform
    • Delphi IDE and APIs
    • General Help
    • Delphi Third-Party
  • C++Builder Questions and Answers
    • General Help
  • General Discussions
    • Embarcadero Lounge
    • Tips / Blogs / Tutorials / Videos
    • Job Opportunities / Coder for Hire
    • I made this
  • Software Development
    • Project Planning and -Management
    • Software Testing and Quality Assurance
  • Community
    • Community Management

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start




Found 8 results

  1. Erik Vestergaard

    JsonTypeInfo in Delphi?

    Hi I am trying to write a Delphi RESTCall using JSON. We allready have a javaclass that works. It is using this annotation to make Jackson able to parse correctly. @JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, property = "className") But what is the correspondent construction in Delphi? My code: s := TJson.ObjectToJsonString(o90RpcCall); The error I get is this: <div>JSON parse error: Missing type id when trying to resolve subtype of [simple type, class java.lang.Object]: missing type id property 'className' (for POJO property 'args'); nested exception is com.fasterxml.jackson.databind.exc.InvalidTypeIdException: Missing type id when trying to resolve subtype of [simple type, class java.lang.Object]: missing type id property 'className' (for POJO property 'args') at [Source: (PushbackInputStream); line: 1, column: 181] (through reference chain: o90client.generel.JSONRPCCall["args"]->java.lang.Object[][0])</div></body></html> I guess it is because of the lack of annotation in my class
  2. Hello,I am learning to use the TJSONIterator(Readers and Writers JSON Framework) under delphi 10.3.3 and I found a russian link putting this into practice through the creation of an application assessing the negative impact on the environment: https://webdelphi.ru/. Firstly, i have a custom class definition named "NVOS.JsonParser.pas" and the "open-data-1.json" file, i don't know how to proceed However, I can't figure out already knowing that the result should look like: "App.png". open-data-1.json
  3. Consider this pseudo code uses Rest.Json; TDateClass = class private FHasDate: TDateTime; FNoDate: TDateTIme; public constructor Create; property HasDate: TDateTime read FHasDate write FHasDate; property NoDate: TDateTime read FNoDate write FNoDate; end; constructor TDateClass.Create; begin HasDate := Now; NoDate := 0; end; var Json: String; DateClass: TDateClass; begin DateClass := TDateClass.Create; Json := TJson.ObjectToJsonString(Self, [joIgnoreEmptyStrings, joIgnoreEmptyArrays, joDateIsUTC, joDateFormatISO8601]); which results in the Json string looking like { "HasDate":"2019-02-14T06:09:00.000Z", "NoDate":"1899-12-30T00:00:00.000Z", } while the ideal result would be { "HasDate":"2019-02-14T06:09:00.000Z", } Q:Is there a way to make TDateTime properties with a zero value be output as an empty string - and hence be stripped?
  4. Jacek Laskowski

    JSON string value

    Does Delphi have a function in RTL that will encode the text to a form consistent with the JSON value? For example, from string: "value\with {strange}chars/" to: "\"value\\with\r\n{strange}chars\/\"" It is possible?
  5. Hi, I cannot get this procedure TPerson.LoadSettings(const aJsonString: String). Is there any reason why self instance is not updated with new value ? Is their any workaround or should I create a LoadSettings method outside TPerson ? program Project1; {$APPTYPE CONSOLE} {$R *.res} uses System.SysUtils, REST.JSON, Unit1 in 'Unit1.pas'; var Person:TPerson; jsonstr:string; begin try Person:=TPerson.Create; try person.Name := 'Hello'; jsonstr:= Person.SaveSettings; writeln(jsonstr); //write {"name":"hello"} person.Name := 'hi'; Person.LoadSettings(jsonstr); writeln(person.Name); //write hi instead of Hello readln; finally Person.Free; end; except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end; end. unit Unit1; interface type TPerson = class(TObject) private FName: string; public procedure LoadSettings(const aJsonString: String); function SaveSettings: string; property Name: string read FName write FName; end; implementation uses REST.JSON; procedure TPerson.LoadSettings(const aJsonString: String); begin self := TJSon.JsonToObject<TPerson>(aJsonString); end; function TPerson.SaveSettings: string; begin result := TJSon.ObjectToJsonString(self); end; end. Ps: I'm using Delphi RIO Updt 2
  6. Flavio Basile

    Firedac Json Reflection from XE7 to Rio

    Hi All; we have a big commercial project; It is coded with C++ Builder XE7. We have many Web Broker that after a call returns a dataset by Firedac Json Reflection. We would like to migrate our code from XE7 to Rio but we would like to know if there are difference between Json Reflection format of XE7 and Rio. There are also some important difference in Firedac between XE7 and Rio that we need to evaluate? Could we migrate our code without any important problems? Thanks, Flavio
  7. It is just a small addition to MARS Client library capabilities but TMARSClientResourceJSON now implements REST.Client.IRESTResponseJSON interface (from Delphi's REST Client library). This basically means you can use a TMARSClientResourceJSON and materialize a dataset through the TRESTResponseDataSetAdapter component (from Delphi's REST Client library). Enjoy 😉
  8. I have strange problem occurring when parsing a JSON string on iOS using the System.JSON library in Berlin. I call TJSONObject.ParseJSONValue() to get a value from the start of a JSON string which has worked fine if I run under Windows. As soon as I run under iOS, the same JSON string causes a null pointer exception. When debugging through, the null pointer is the TJSONObject class itself which is odd as ParseJSONValue() is a class function so don’t know why that would ever happen. I suspect this isn’t really the case and is just what the debugger is interpreting (the iOS debugger in Berlin isn’t great). I suspect the JSON string is too large for the parser as it’s a huge string. My question is whether anyone is aware of a size limit for parsing a JSON string or whether there’s a known issue in the Berlin JSON libraries which might cause this? Unfortunately I can’t provide a sample JSON string as it’s a client’s backup data but hopefully someone will be able to help.