MCPcopy Create free account
hub / github.com/Effect-TS/effect / fromJsonString

Function fromJsonString

packages/effect/src/Schema.ts:12436–12445  ·  view source on GitHub ↗
(
  schema: S,
  options?: {
    readonly reviver?: Parameters<typeof JSON.parse>[1] | undefined
    readonly replacer?: SchemaGetter.JsonReplacer | undefined
    readonly space?: Parameters<typeof JSON.stringify>[2] | undefined
  }
)

Source from the content-addressed store, hash-verified

12434 * @since 4.0.0
12435 */
12436export function fromJsonString<S extends Constraint>(
12437 schema: S,
12438 options?: {
12439 readonly reviver?: Parameters<typeof JSON.parse>[1] | undefined
12440 readonly replacer?: SchemaGetter.JsonReplacer | undefined
12441 readonly space?: Parameters<typeof JSON.stringify>[2] | undefined
12442 }
12443): fromJsonString<S> {
12444 return JsonString.pipe(decodeTo(schema, SchemaTransformation.fromJsonString(options)))
12445}
12446
12447/** @internal */
12448export const UnknownFromJsonString: fromJsonString<Unknown> = fromJsonString(Unknown)

Callers 1

Schema.tsFile · 0.70

Calls 2

decodeToFunction · 0.70
pipeMethod · 0.65

Tested by

no test coverage detected