AddMarshaledJSON parses the provided raw json data and adds the found fields into the current list (following the same rule as the Add method). The rawJSON argument could be one of: - serialized array of field objects - single field object. Example: l.AddMarshaledJSON([]byte{`{"type":"text", nam
(rawJSON []byte)
| 152 | // l.AddMarshaledJSON([]byte{`{"type":"text", name: "test"}`}) |
| 153 | // l.AddMarshaledJSON([]byte{`[{"type":"text", name: "test1"}, {"type":"text", name: "test2"}]`}) |
| 154 | func (l *FieldsList) AddMarshaledJSON(rawJSON []byte) error { |
| 155 | extractedFields, err := marshaledJSONtoFieldsList(rawJSON) |
| 156 | if err != nil { |
| 157 | return err |
| 158 | } |
| 159 | |
| 160 | l.Add(extractedFields...) |
| 161 | |
| 162 | return nil |
| 163 | } |
| 164 | |
| 165 | // AddMarshaledJSONAt is the same as AddMarshaledJSON but insert/move the fields at the specific position. |
| 166 | // |