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)
- recursive descent on object, unexpected results HOT 7
- Add float write format option HOT 1
- Array type with windowing like functionality? HOT 2
- Panic on setting a nil value on JSONPath HOT 3
- '' is not a valid operation at 16 in $..book[[email protected]] HOT 9
- oj.Unmarshal fails on arrays HOT 4
- Can I get a Normalized Path in JP? (ietf) HOT 13
- Add jp.Expr.Locate() HOT 9
- Support Keyed and Indexed interfaces in `jp.Expr.Modify` HOT 1
- Script with regex fails HOT 3
- Negation operator is not working HOT 11
- The json hierarchy if too deep resulting in no matching HOT 12
- Consider implementing JSONPath HOT 9
- 0x24 ($) is not a valid escaped character HOT 9
- Inconsitent capitalization and loss of capitalization in pretty.JSON for structs HOT 4
- Cannot parse when properties start with "$" HOT 1
- Feature Request: Some way to iterate across object properties (k, v) or at least get keys HOT 7
- Feature Request: enable copy and move of jpath to other parts of hierarchy HOT 2
- Compile failed for the reason that the tag v1.12.8 has been deleted HOT 2
- Cannot delete from array? HOT 8
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.