Skip to content

API Reference


API Reference / @dasch-ng/utils / src / ParseJsonPipe

Class: ParseJsonPipe ​

Defined in: libs/ng/utils/src/lib/parse-json.pipe.ts:14

Parses a JSON string and returns null instead of throwing for invalid JSON or non-string input. The type argument only documents the expected shape; the result is not validated.

Example ​

html
@let settings = row.settingsJson | parseJson;
@if (settings) { <pre>{{ settings | json }}</pre> }

Implements ​

  • PipeTransform

Constructors ​

Constructor ​

new ParseJsonPipe(): ParseJsonPipe

Returns ​

ParseJsonPipe

Methods ​

transform() ​

transform<T>(value): T | null

Defined in: libs/ng/utils/src/lib/parse-json.pipe.ts:15

Type Parameters ​

T ​

T = unknown

Parameters ​

value ​

unknown

Returns ​

T | null

Implementation of ​

PipeTransform.transform

Released under the MIT License.