1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- package test
- import (
- "Yunlot/lib"
- "encoding/json"
- "strings"
- "testing"
- )
- func Test_jsonkey(t *testing.T) {
- var data = `{
- "clientID": "869023065073597",
- "msgID": "24152",
- "msgID11": "1111",
- "msgID22": "1111",
- "msgID33": "3333",
- "AAAA": {
- "typeCode": "123",
- "typeCode2": "123",
- "AAAA": {
- "name": "TempSet",
- "value": "272"
- },
- "BBBB": [{
- "name": "TempSet",
- "value": "266666"
- }],
- "CCCC": [{
- "name": "TempSet",
- "value": "2766662"
- }]
- },
- "paramsb": {
- "typeCode": "123",
- "typeCode2": "123"
- },
- "paramslist": [{
- "typeCode": "123",
- "typeCode2": "123"
- }]
- }`
- var articleSlide map[string]interface{}
- err := json.Unmarshal([]byte(data), &articleSlide)
- if err != nil {
- }
- topicName := "/paramsb/"
- topicName = strings.Trim(topicName, "/")
- topicNameList := strings.Split(topicName, "/")
- x := lib.Json_key(topicNameList, 0, articleSlide)
- println(x)
- }
|