i finaly have it :D in fact, the whole struct of httpbin returns have to be
describe through different structures to works.
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
type User struct {
Firstname string `json:"firstname"`
L
and without the use of http.post, the encode / decode methods works :(
i also try this but it doesn't work too.
func main() {
type User struct {
Firstname string `json: "firstname"`
Lastname string `json: "lastname"`
}
type httpbin struct {
Origin string `json
when i try something like that:
res, _ := http.Post("https://httpbin.org/post";, "application/json;
charset=utf-8", b)
var newuser map[string]interface{}
json.NewDecoder(res.Body).Decode(&newuser)
fmt.Println(newuser["json"])
it prints me correctly the content a map containing th
when i try something like that:
res, _ := http.Post("https://httpbin.org/post";, "application/json;
charset=utf-8", b)
var newuser map[string]interface{}
json.NewDecoder(res.Body).Decode(&newuser)
fmt.Println(newuser["json"])
it prints me correctly the content a map containing th
Have a try with jsonparser.Get()?
在 2018年8月14日星期二 UTC+8下午6:19:20,nicolas...@yahoo.fr写道:
>
> Hello
>
> I need some assistance to decode a json content
>
> I tried to use only usefull code to do it but don't success to retrieve
> the data part of the json result.
>
> var user struct {
>