MCPcopy
hub / github.com/tidwall/gjson / TestIssue6

Function TestIssue6

gjson_test.go:715–750  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

713}
714
715func TestIssue6(t *testing.T) {
716 data := `{
717 "code": 0,
718 "msg": "",
719 "data": {
720 "sz002024": {
721 "qfqday": [
722 [
723 "2014-01-02",
724 "8.93",
725 "9.03",
726 "9.17",
727 "8.88",
728 "621143.00"
729 ],
730 [
731 "2014-01-03",
732 "9.03",
733 "9.30",
734 "9.47",
735 "8.98",
736 "1624438.00"
737 ]
738 ]
739 }
740 }
741 }`
742
743 var num []string
744 for _, v := range Get(data, "data.sz002024.qfqday.0").Array() {
745 num = append(num, v.String())
746 }
747 if fmt.Sprintf("%v", num) != "[2014-01-02 8.93 9.03 9.17 8.88 621143.00]" {
748 t.Fatalf("invalid result")
749 }
750}
751
752var exampleJSON = `{
753 "widget": {

Callers

nothing calls this directly

Calls 3

GetFunction · 0.85
ArrayMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…