You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+17-4Lines changed: 17 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,11 +26,24 @@ import Data.Argonaut.Core as J
26
26
import Data.Codec.Argonaut as CA
27
27
import Data.Either (Either)
28
28
29
-
encodeString ∷ String → J.Json
30
-
encodeString = CA.encode CA.string
29
+
codec = CA.array CA.string
30
+
31
+
encodeStringArray ∷ Array String → J.Json
32
+
encodeStringArray = CA.encode codec
33
+
34
+
decodeStringArray ∷ J.Json → Either CA.JsonDecodeError (Array String)
35
+
decodeStringArray = CA.decode codec
36
+
```
37
+
38
+
To parse a serialized `String` into a `J.Json` structure use the [`Parser.jsonParser`](https://pursuit.purescript.org/packages/purescript-argonaut-core/5.1.0/docs/Data.Argonaut.Parser).
39
+
40
+
To /"stringify"/ (serialize) your `Array String` to a serialized JSON `String` we would use the [`stringify`](https://pursuit.purescript.org/packages/purescript-argonaut-core/5.1.0/docs/Data.Argonaut.Core#v:stringify) like so:
41
+
42
+
```purescript
43
+
import Control.Category ((>>>))
31
44
32
-
decodeString ∷ J.Json → Either CA.JsonDecodeError String
0 commit comments