GuessJSONStream scans the provided reader up to size, looking for an open brace indicating this is JSON. It will return the bufio.Reader it creates for the consumer.
(r io.Reader, size int)
| 323 | // for an open brace indicating this is JSON. It will return the |
| 324 | // bufio.Reader it creates for the consumer. |
| 325 | func GuessJSONStream(r io.Reader, size int) (io.Reader, []byte, bool) { |
| 326 | buffer := bufio.NewReaderSize(r, size) |
| 327 | b, _ := buffer.Peek(size) |
| 328 | return buffer, b, hasJSONPrefix(b) |
| 329 | } |
| 330 | |
| 331 | var jsonPrefix = []byte("{") |
| 332 |