The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 2,432 other followers

Archive for the ‘JSON’ Category

JSONPlaceholder – Fake online REST API for developers

Posted by jpluimers on 2021/03/25

A great way for testing REST JSON calls is using the [WayBack] JSONPlaceholder – Fake online REST API for developers:

Fake Online REST API for Testing and Prototyping
Serving ~200M requests per month
Powered by JSON Server [WayBack] + LowDB [WayBack]

It is like [WayBack] Placeholder.com: Placeholder Images Done For You [JPG, GIF & PNG] but for JSON and supports both CORS and JSON-P for cross domain requests.

You can either use that site (which has a predefined set of REST calls) or the basic [WayBack] My JSON Server – Fake online REST server for teams that allows you to respond it to a db.json file from github:

Fake Online REST server for teams

Create a JSON file on GitHub

github.com/user/repo/master/db.json
{
  "posts": [
    {
      "id": 1,
      "title": "hello"
    }
  ],
  "profile": {
    "name": "typicode"
  }
}

Get instantly a fake server

my-json-server.typicode.com/user/repo/posts/1
{
  "id": 1,
  "title": "hello"
}

Related

Documentation

There is basic documentation at the repository [WayBack] GitHub – typicode/jsonplaceholder: A simple online fake REST API server:

Read the rest of this entry »

Posted in Communications Development, Development, HTTP, Internet protocol suite, JavaScript/ECMAScript, JSON, REST, Scripting, Software Development, TCP | Leave a Comment »

How do I pretty-print JSON in Delphi? – Stack Overflow

Posted by jpluimers on 2021/02/09

For my archive: the [WayBack] How do I pretty-print JSON in Delphi? – Stack Overflow answer by [WayBack] Bob:

If you do not want to use any external library, and you’re using a Delphi XE5 or newer, there is a very handy TJson.Format() function in the REST.Json unit.

uses json, REST.Json;

{ ... }    

function FormatJSON(json: String): String;
var
  tmpJson: TJsonObject;
begin
  tmpJson := TJSONObject.ParseJSONValue(json);
  Result := TJson.Format(tmpJson);

  FreeAndNil(tmpJson);
end;

–jeroen

Posted in Delphi, Development, JavaScript/ECMAScript, JSON, Scripting, Software Development | Leave a Comment »

JSON to tabular format via JSONformatter.org and JSON2table.com

Posted by jpluimers on 2020/11/10

Two interesting sites to ease transforming JSON fragments in log-messages to a table system, for instance Excel.

  1. Paste the bits in [WayBack] Best JSON Pretty Print Online then fix any syntax errors.
  2. Copy from there to [WayBack] json2table.com and press the triangle button (run)
  3. Copy either the tabular or tree result to your favourite program.
  4. Format any numbers for readability. I really like the Custom format ##0.00E+00 that just shows the exponents in multiples of 3 (so kilo, mega, giga, etc)[WayBack] formatting – How can I format bytes a cell in Excel as KB, MB, GB etc? – Stack Overflow

This way I copied the example code into adjecent Excel areas, so I could compare the values and calculate memory increase of a Delphi application.

jeroen

Read the rest of this entry »

Posted in Development, JavaScript/ECMAScript, JSON, LifeHacker, Power User, Scripting, Software Development | Leave a Comment »

Go character and string literals: regular (‘), double (“) and back-tick (`) quotes

Posted by jpluimers on 2020/10/01

For my link archive:

Back-ticks can be very useful for instance when you need to specifying json tags.

References for that:

–jeroen

Posted in Development, Encoding, Go (golang), JavaScript/ECMAScript, JSON, Scripting, Software Development | Leave a Comment »

Insomnia REST Client

Posted by jpluimers on 2020/05/12

[WayBack] Insomnia REST Client  A powerful REST API Client with cookie management, environment variables, code generation, and authentication for Mac, Window, and Linux.

Source code at [WayBack] GitHub – getinsomnia/insomnia: The most intuitive cross-platform REST API Client 😴.

Via: [WayBack] Paw is nice – The Isoblog.

–jeroen

 

 

Posted in Communications Development, Development, HTTP, Internet protocol suite, JavaScript/ECMAScript, JSON, REST, Scripting, Software Development, TCP, Web Development | Leave a Comment »

 
%d bloggers like this: