How to use jsona - 2 common examples

To help you get started, we’ve selected a few jsona 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 tokend / new-js-sdk / src / api2 / middlewares / parse-jsonapi-response.js View on Github external
_parseResponse (response) {
    if (response.status === 204) {
      return
    }

    const formatter = new Jsona({
      DeserializeCache: DeserializeCacheStub
    })
    const parsed = formatter.deserialize(response.data)

    this._data = toCamelCaseDeep(parsed)
  }
github tokend / new-js-sdk / src / base / operations / redemption_request_op_builder.spec.js View on Github external
allTasks: 1,
      creatorDetails: '{"creator":"details"}'
    }

    let op = RedemptionRequestBuilder.redemptionRequest(opts)
    let xdrOp = op.toXDR('hex')

    let operation = xdr.Operation.fromXDR(Buffer.from(xdrOp, 'hex'))

    let obj = Operation.operationToObject(operation)

    expect(obj.type).to.be.equal(xdr.OperationType.createRedemptionRequest().name)
    expect(obj.sourceBalanceId).to.be.equal(opts.sourceBalanceId)
    expect(obj.destination).to.be.equal(opts.destination)
    expect(obj.amount).to.be.equal(opts.amount)
    expect(jsonStringify(obj.creatorDetails)).to.be.equal(opts.creatorDetails)
    expect(obj.allTasks).to.be.equal(opts.allTasks)
  })
})

jsona

Provide data formatters (data model builder & json builder) to work with JSON API specification v1.0 in your JavaScript / TypeScript code

MIT
Latest version published 1 year ago

Package Health Score

60 / 100
Full package analysis

Popular jsona functions