This recipe contains a very specific use case, where your program consumes the JSON from an unreliable source and the JSON contains an array of objects which has the beginning token [ but the number of items in the array is very large, and the end of the JSON could be corrupted.
Extracting data from an incomplete JSON array
How to do it...
- Open the console and create the folder chapter05/recipe13.
- Navigate to the directory.
- Create the json.go file with the following content:
package main
import (
"encoding/json"
"fmt"
"strings"
)
const js = `
[
{
"name":"Axel",
"lastname...