Comments (3)
Glad to help. You can use OjG for the unmarshalling as well. It is faster than jsoniter when unmarshalling into a map[string]interface{}
. I still have to optimize unmarshalling into a struct though.
from ojg.
Before getting to the issue, the jp package doesn't have a MustParse as you noticed. Instead it has the easy build functions so you could use x := jp.R().C("foo").C("bar").C("bad")
or just leave off the R()
since it is optional. Of course for more complex expression the approach you took is very reasonable. Just wanted to pass along the hint.
As for the issue, if I look at the OjG code I see that the provided data which is a map is being accessed but since the call to Get()
is in a single go routine it must be colliding with some other part of the code. I would need to know more about the rest of the environment to nail it down further. Where is the map/data being created or written to?
from ojg.
Thanks for the prompt response and usage tip! Your comment was extremely insightful: I now believe my code is at fault here. For closure, the flow of the issue is below:
var event map[string]interface{}
_ = jsoniter.Unmarshal(msg, &event) // msg is []byte of json
go func() {
// code that ultimately will call ojg's Get func
}
// code that overwrites a couple of keys in the map[string]interface{} populated by the jsoniter.Unmarshal call
I apologize for taking your time, but you've saved me quite a bit of time in finding the root cause.
from ojg.
Related Issues (20)
- Sponsor this project HOT 4
- not support token contain '-' ? HOT 11
- Double value parse error on iOS platform HOT 6
- preserve order of JSONPath elements (when using wildcard) HOT 6
- Getting full path of a rule in the json HOT 1
- oj.Marshal fails on embedded interface HOT 2
- Extracting Multiple Fields HOT 2
- Array indexes with last return reverse order HOT 4
- Is it possible to use JSONPath to pick the objects without a particular field? HOT 4
- Working with a collection of JSONPaths simultaneously? HOT 2
- Does JsonPath supports escaping? HOT 13
- Option to keep order of keys HOT 16
- Does support ”-“ HOT 1
- Parse '1,2,3' should not succeed HOT 3
- Expr.String() doesn't escape strings HOT 6
- Question: Using jp.Set() to set non-existent slice indices HOT 2
- Maybe a regression on path filters on version 1.18.0 HOT 3
- support for "json" tag in struct elements HOT 4
- Single or Multiple HOT 6
- Provides the length functionality HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ojg.