Comments (4)
JSON specifically does not allow you to parse something that does not have curly braces at root. Reading through the docs, it looks like HOCON allows you to omit the curly braces, but it still assumes that the thing at root can be converted to an object, which a list cannot. You could try adding curly braces around it (not sure if that's an option). I'd need to investigate more to come up with other solutions, but the code that is erroring is here: https://github.com/puppetlabs/cpp-hocon/blob/master/lib/src/parseable.cc#L124. That function is the last thing called before the config object gets returned, so it attempts to coerce everything to an object at the top level.
from cpp-hocon.
After double-checking RFC 4627, I'm pretty sure an array at the top is allowed. It can be either an object or an array.
Works with nlohmann's library and on jsonlint.com: [ {"a": 1} ]
from cpp-hocon.
Yeah you're right, I found the place that specifies that now... I'll have to play around with it more to see if we ever tested that functionality, and if not, where our code differs from the code that supports that.
from cpp-hocon.
https://github.com/lightbend/config/blob/master/HOCON.md#include-semantics-merging specifically talks about this behavior of both HOCON and JSON, and how included files differ.
from cpp-hocon.
Related Issues (18)
- Why is include name hocon/xxx but library is libcpp-hocon? HOT 2
- Self-Referential Substitutions don't work HOT 11
- Fails to build with Boost 1.72 HOT 3
- Is there a way to write configuration parameters to files ? HOT 1
- Automatically regenerate gh-pages branch on release
- Example doesn't compile, and segfaults when you fix the compilation issues
- Tests fail to compile with pre-release glibc and leatherman-vendored Catch HOT 3
- How can I merge two configs? HOT 2
- Good reference identified as "part of a cycle of substitutions"
- Some basic examples needed HOT 4
- "include" with files crashes HOT 3
- Valgrind errors (no observable impact) HOT 2
- releases aren't buildable HOT 2
- include quoted string HOT 2
- included file root
- Resolving inheritence/overloading HOT 2
- the include command causes an error HOT 11
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 cpp-hocon.