Treatment toJson

json::toJson


Inputs

⇥ text: Stream<string>

Outputs

↦ error: Stream<Option<string>>
↦ json: Stream<Option<Json>> (json::Json)


Parse each string in the stream into a Json value.

For every element: json receives some(Json) on success and none on failure; error receives none on success and some(message) on failure. Both outputs always emit one value per input.

graph LR
     T("toJson()")
     A["🟦 … 🟨"] -->|text| T
     T -->|json| B["〈🟦〉 … 〈none〉"]
     T -->|error| E["〈none〉 … 〈🟥〉"]

     style A fill:#ffff,stroke:#ffff
     style B fill:#ffff,stroke:#ffff
     style E fill:#ffff,stroke:#ffff