This package used to provide a JSONFromString type but it looks like this was removed in v0.5.0. Perhaps this was removed in favour of Either.parseJSON?
However, it would still be useful to provide a JSONFromString type in this package because it's not easy to define yourself using Either.parseJSON.
export const JSONFromString = new t.Type<E.Json, string, string>(
'JSONFromString',
// TODO:
(x): x is E.Json => true,
(s, c) =>
pipe(
E.parseJSON(s, (_e) => 'whatever'),
E.fold(() => t.failure(s, c), t.success),
),
JSON.stringify,
);
In order to correctly implement the is function we would need to create a Json runtime type:
🚀 Feature request
This package used to provide a
JSONFromString
type but it looks like this was removed in v0.5.0. Perhaps this was removed in favour ofEither.parseJSON
?However, it would still be useful to provide a
JSONFromString
type in this package because it's not easy to define yourself usingEither.parseJSON
.In order to correctly implement the
is
function we would need to create aJson
runtime type:Would you consider a PR that brings this back?