How to use the dummy-json.parse function in dummy-json

To help you get started, we’ve selected a few dummy-json examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / vscode-azure-iot-toolkit / src / simulator.ts View on Github external
ids.map((j) => {
        // We use a template so that each time the message can be randomly generated.
        const generatedMessage = isTemplate
        ? dummyjson.parse(template)
        : template;
        this.sendD2CMessageCore(
          clients[j],
          generatedMessage,
          statuses[j],
          this.totalStatus,
        );
      });
      this.totalStatus.addSent(deviceCount);
github mockoon / mockoon / src / app / libs / dummy-helpers.lib.ts View on Github external
export const DummyJSONParser = (text: string, request: any): string => {
  return DummyJSON.parse(text, { helpers: DummyJSONHelpers(request) });
};
github node-red / node-red-nodes / function / datagenerator / datagenerator.js View on Github external
node.on("input", function(msg) {
            if (msg.seed) { dummyjson.seed = msg.seed; }
            try {
                var value = dummyjson.parse(node.template, {mockdata: msg});
                if (node.syntax === "json") {
                    try { value = JSON.parse(value); }
                    catch(e) { node.error(RED._("datagen.errors.json-error")); }
                }
                if (node.fieldType === 'msg') {
                    RED.util.setMessageProperty(msg,node.field,value);
                }
                else if (node.fieldType === 'flow') {
                    node.context().flow.set(node.field,value);
                }
                else if (node.fieldType === 'global') {
                    node.context().global.set(node.field,value);
                }
                node.send(msg);
            }
            catch(e) {
github microsoft / vscode-azure-iot-toolkit / src / simulatorwebview / localserver.ts View on Github external
private async generateRandomJson(
    req: express.Request,
    res: express.Response,
    next: express.NextFunction,
  ) {
    const data = req.body;
    const template = data.template;
    try {
      const message = dummyjson.parse(template);
      return res.status(200).json(message);
    } catch (err) {
      return res.sendStatus(400);
    }
  }
}

dummy-json

Dummy JSON mock data generator for Node.js

MIT
Latest version published 3 years ago

Package Health Score

45 / 100
Full package analysis

Similar packages