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
Both encoder and decoder fully conform to [RFC 8259](https://tools.ietf.org/html/rfc8259) and [ECMA 404](https://ecma-international.org/publications-and-standards/standards/ecma-404/) standards.
162
160
163
161
### Encoding
164
162
165
-
Encoding can be done via `JSON.encode!/1` and `JSON.encode_to_iodata!/1` functions.
166
-
The default encoding rules are applied as follows:
163
+
Encoding can be done via `JSON.encode!/1` and `JSON.encode_to_iodata!/1` functions. The default encoding rules are applied as follows:
167
164
168
165
|**Elixir**|**JSON**|
169
166
|------------------------|----------|
@@ -177,9 +174,7 @@ The default encoding rules are applied as follows:
177
174
|`%{atom() => _}`| Object |
178
175
|`%{integer() => _}`| Object |
179
176
180
-
You may also implement the `JSON.Encoder` protocol for custom data structures.
181
-
If you have a struct, you can derive the implementation of the `JSON.Encoder`
182
-
by specifying which fields should be encoded to JSON:
177
+
You may also implement the `JSON.Encoder` protocol for custom data structures. If you have a struct, you can derive the implementation of the `JSON.Encoder` by specifying which fields should be encoded to JSON:
183
178
184
179
```elixir
185
180
@derive {JSON.Encoder, only: [...]}
@@ -188,8 +183,7 @@ by specifying which fields should be encoded to JSON:
188
183
189
184
### Decoding
190
185
191
-
Decoding can be done via `JSON.decode/2` and `JSON.decode!/2` functions.
192
-
The default decoding rules are applied as follows:
186
+
Decoding can be done via `JSON.decode/2` and `JSON.decode!/2` functions. The default decoding rules are applied as follows:
0 commit comments