hjson-cs | Hjson for C # - Hjson , a user interface for JSON | JSON Processing library
kandi X-RAY | hjson-cs Summary
kandi X-RAY | hjson-cs Summary
Hjson, a user interface for JSON. JSON is easy for humans to read and write... in theory. In practice JSON gives us plenty of opportunities to make mistakes without even realizing it. Hjson is a syntax extension to JSON. It's NOT a proposal to replace JSON or to incorporate it into the JSON spec itself. It's intended to be used like a user interface for humans, to read and edit before passing the JSON data to the machine. Supported frameworks/runtimes include .NET Core, .NET 4.x & Mono.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of hjson-cs
hjson-cs Key Features
hjson-cs Examples and Code Snippets
Community Discussions
Trending Discussions on hjson-cs
QUESTION
I'm trying to use HJSON C# library for Powershell: https://github.com/hjson/hjson-cs I've successfully compiled the dll, put it into a folder and added the type via standard procedure:
...ANSWER
Answered 2018-Apr-12 at 21:15The library is just written in a way that doesn't work great with how PowerShell displays data it doesn't have format information for.
WhyJsonValue
(the type emitted byHjson.Load
) is more or less a dictionary ofstring
toJsonPrimitive
(or moreJsonValue
for nesting).The reason you don't see any values when you output the variable is because PowerShell by default just converts objects to a string. The
JsonValue
to string conversion is just an empty string, so it appears like a null value, but it's a full object.The reason it throws the
InvalidOperationException
referencing enumeration is because PowerShell tries to enumerate anything that implementsIEnumerable
. But,JsonPrimitive
will throw when you try to enumerate it if the real value of the object isn't an array.
If you want to get an individual value, you can call the JsonPrimitive.ToValue
method. This will convert the JsonPrimitive
to the equivalent .NET type.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install hjson-cs
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page