-
-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add serialization example #11
Comments
For serialization the block
use jonquil, only : json_serialize
character(:), allocatable :: str
str = json_serialize(object)
print '(a)', str
end block To create the JSON object, have a look in the block
use jonquil, only : json_object, set_value
type(json_object) :: object
type(json_object), pointer :: child
call set_value(object, "val", 1.0)
call set_value(object, "sub", child)
call set_value(child, "val", 2.0)
! ...
end block |
Thanks. I found the program main
use jonquil
implicit none
type(json_object) :: json
call new_object(json)
call set_value(json, 'hello', 'world')
print *, json_serialize(json)
end program However, the output using ,"hello": "world"} Is it maybe a bug? 🤔 |
Same result using |
The comma is produced in Line 347 in 02e3c4c
Looks like I transcribed this incorrectly from which would produce an opening brace. So definitely a bug. |
Fixed the serialization error. Let me know if you find any other discrepancies. |
Looks good, thanks for the very quick fix. |
Please add an example on how to build a JSON from scratch and serialize it.
The text was updated successfully, but these errors were encountered: