Skip to content

03.3 Parsers

Amit Gupta edited this page Jun 11, 2018 · 2 revisions

It is difficult to write stub/response for data formats which supports binary or ASCII characters. Hence Stubmatic provides the support of parsers. Now you can maintain the data in JSON and specify relevant parser in request-response mapping.

There are two parsers supports currently

  1. निम्न (Nimn) : Reduces the size of data approx 60% in comparison of JSON. But you need to saves the object structure in different file.

Media type: application/nimn, application/vnd.nimn

-  request:
      method: GET
      url: /stubs/profile/([0-9])+

   response:
      parser: 
        type: jsonToNimn
        options:
           schema: path/of/schema/file
      file: profile.json

Check nimnjs to understand schema structure. You can also build structure automatically.

  1. msgpack : Reduces the size of data approx 20% in comparison of JSON.
-  request:
      method: GET
      url: /stubs/profile/([0-9])+

   response:
      parser: 
        type: jsonToMsgpack
      file: profile.json
Clone this wiki locally