How to use the jsonpath.value function in jsonpath

To help you get started, we’ve selected a few jsonpath 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 airware / stepfunctions-local / src / lib / tools / path.js View on Github external
function applyJsonPath(object, path = '$') {
  if (typeof object === 'object' && object !== null) {
    return jp.value(object, path) || {};
  }
  return object;
}
github mmendesas / walnutjs / src / support / parser / jsonparser.js View on Github external
setValue: function (path, value) {
        jp.value(this.jsonObj, path, value);
    },
github RiseVision / rise-node / packages / core-helpers / src / appState.ts View on Github external
public set(what: string, value: any) {
    jsonpath.value(this.states, `$.${what}`, value);
  }
github RiseVision / rise-node / packages / core-helpers / src / appState.ts View on Github external
public getComputed(what: string): any {
    const fn = jsonpath.value(this.computed, `$.${what}`);
    if (typeof fn !== 'function') {
      return undefined;
    }
    return fn(this);
  }
github magda-io / magda / magda-csw-connector / src / CswConnector.ts View on Github external
protected getNameFromJsonOrganization(jsonOrganization: any): string {
        return jsonpath.value(jsonOrganization, '$.organisationName[0].CharacterString[0]._');
    }
github magda-io / magda / magda-csw-connector / src / cswFuncs.ts View on Github external
return lodash.groupBy(responsibleParties, party =>
        jsonpath.value(
            party,
            '$.role[*].CI_RoleCode[*]["$"].codeListValue.value'
        )
    );
github magda-io / magda / magda-csw-connector / src / CswTransformer.ts View on Github external
private getRawDatasetId(jsonDataset: any): string {
        const urnIdentifier = jsonpath.value(
            jsonDataset.json,
            "$..MD_Identifier[?(@.codeSpace[0].CharacterString[0]._=='urn:uuid')].code.._"
        );

        const fileIdentifier = jsonpath.value(
            jsonDataset.json,
            "$.fileIdentifier[*].CharacterString[*]._"
        );

        return fileIdentifier || urnIdentifier;
    }
github magda-io / magda / magda-csw-connector / src / CswConnector.ts View on Github external
protected getNameFromJsonDataset(jsonDataset: any): string {
        const dataIdentification = jsonpath.query(jsonDataset.json, '$.identificationInfo[*].MD_DataIdentification[*].dataIdentification[*]');
        const serviceIdentification = jsonpath.query(jsonDataset.json, '$.identificationInfo[*].SV_ServiceIdentification[*].serviceIdentification[*]');
        const identification = dataIdentification || serviceIdentification || {};
        const title = jsonpath.value(identification, '$.citation[*].CI_Citation[*].title[*].CharacterString[*]._') || this.getIdFromJsonDataset(jsonDataset);
        return title;
    }

jsonpath

Query JavaScript objects with JSONPath expressions. Robust / safe JSONPath engine for Node.js.

MIT
Latest version published 3 years ago

Package Health Score

67 / 100
Full package analysis