My objective is to add fields to json on user request.
Everything is great, but when displaying the fields with
fmt.Printf("%s: %s
", content.Date, content.Description)
an error occurs:
invalid character '{' after top-level value
And that is because after adding new fields the file looks like this:
{"Date":"2017-03-20 10:46:48","Description":"new"}
{"Date":"2017-03-20 10:46:51","Description":"new .go"}
The biggest problem is with the writting to file
reminder := &Name{dateString[:19], text} //text - input string
newReminder, _ := json.Marshal(&reminder)
I dont really know how to do this properly
My question is how should I wrap all member fields into one object? And what is the best way to iterate through member fields?
The code is available here: https://play.golang.org/p/NunV_B6sud