I am trying to convert a json string from an http request to a slice of map/s. And I should also convert a slice of map/s to json string to use for a http response.
I want to convert the followings into a slice of map/s, in both cases below. The json string from the http request may be an array of several same key value json objects, like;
[
{ title: 'JavaScript: The Good Parts', author: 'Douglas Crockford',
releaseDate: '2008', keywords: 'JavaScript Programming' },
{ title: 'The Little Book on CoffeeScript', author: 'Alex MacCaw',
releaseDate: '2012', keywords: 'CoffeeScript Programming' },
{ title: 'Scala for the Impatient', author: 'Cay S. Horstmann',
releaseDate: '2012', keywords: 'Scala Programming' },
{ title: 'American Psycho', author: 'Bret Easton Ellis',
releaseDate: '1991', keywords: 'Novel Splatter' },
{ title: 'Eloquent JavaScript', author: 'Marijn Haverbeke',
releaseDate: '2011', keywords: 'JavaScript Programming' }
]
or a single one like;
{ title: 'Eloquent JavaScript', author: 'Marijn Haverbeke',
releaseDate: '2011', keywords: 'JavaScript Programming' }
And the second task is to convert a slice of map/s to a json string.
However, I could not mange to succeed in these two procedures.
json package makes it possible to do these two tasks for structs, I am aware of it.
I should not use structs coded beforehand, for a design concern.
Is there a known way to do these in Go.