JSON

Frends.JSON.EnforceTypes / 2.0.0

Summary

Coerces the values at named JSON paths to the types you declare, fixing documents where numbers, booleans or nulls arrived as strings.

Typical use — cleaning up JSON built from CSV or from a loosely typed API, before a schema check or a database write rejects it

Details

Frends version
5.7 and newer
Agent
Crossplatform
Target framework
net8.0

Input parameters for the EnforceTypes task.

Name Type Default Example Description
Json String {\"hello\": \"123\",\"hello_2\": \"123.5\",\"world\": \"true\",\"bad_arr\": \"hello, world\",\"bad_arr_2\": { \"prop1\": 123 },\"good_arr\": [ \"hello, world\" ],\"good_arr_2\": [ { \"prop1\": 123 } ]}

The JSON string to be processed.

Rules JsonTypeRule[] [{new JsonTypeRule{JsonPath = "hello", DataType = JsonDataType.Number }}, {new JsonTypeRule{JsonPath = "hello_2", DataType = JsonDataType.Number }}]

JSON data type rules to enforce.

An unhandled error has occurred. Reload 🗙