@salesforce/ts-types
    Preparing search index...

    Function getJsonMap

    • Given a deep-search query path, returns an object property or array value from an AnyJson as a JsonMap, or undefined if a value was not found or was not type-compatible.

      const obj = { foo: { bar: [{ a: 'b' }] } };
      const value = getJsonMap(obj, 'foo.bar[0]');
      // type of value -> JsonMap; value -> { a: 'b' }

      Parameters

      • from: Optional<AnyJson>

        The JSON value to query.

      • path: string

        The query path.

      Returns Nullable<JsonMap>

    • Given a deep-search query path, returns an object property or array value from an AnyJson as a JsonMap, or the given default if a value was not found or was not type-compatible.

      const obj = { foo: { bar: [{ a: 'b' }] } };
      const value = getJsonMap(obj, 'foo.bar[1]', { c: 'd' });
      // type of value -> JsonMap; value -> { c: 'd' }

      Parameters

      • from: Optional<AnyJson>

        The JSON value to query.

      • path: string

        The query path.

      • defaultValue: JsonMap

        The default to return if the query result was not defined.

      Returns JsonMap