Skip to content
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

Json Groovy examples not working #19

Open
madmas opened this issue Jan 11, 2021 · 0 comments
Open

Json Groovy examples not working #19

madmas opened this issue Jan 11, 2021 · 0 comments

Comments

@madmas
Copy link

madmas commented Jan 11, 2021

Hi,
I attempt to make use of the JSON datatype using groovy.

I was looking at the examples in https://www.julienviet.com/reactive-pg-client/guide/groovy/index.html

Unfortunately the statement

def tuple = Tuple.of(Json.create(Json.create(null)), Json.create(Json.create([
  foo:"bar"
])), Json.create(Json.create(null)))

fails with

Unexpected error occurred: Invalid json value null with class io.reactiverse.reactivex.pgclient.data.Json
 java.lang.IllegalArgumentException: Invalid json value null with class io.reactiverse.reactivex.pgclient.data.Json
 	at io.reactiverse.pgclient.data.Json.create(Json.java:33)
 	at io.reactiverse.reactivex.pgclient.data.Json.create(Json.java:63)
 	at io.reactiverse.reactivex.pgclient.data.Json$create.call(Unknown Source)
 	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
 	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:115)
 	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:127)

As I was wondering about the duplicate Json.create, but when I remove that I get

 Unexpected error occurred: Invalid json value {foo=bar} with class java.util.LinkedHashMap
 java.lang.IllegalArgumentException: Invalid json value {foo=bar} with class java.util.LinkedHashMap
	at io.reactiverse.pgclient.data.Json.create(Json.java:33)
	at io.reactiverse.reactivex.pgclient.data.Json.create(Json.java:63)
	at io.reactiverse.reactivex.pgclient.data.Json$create.call(Unknown Source)

How would someone use it properly?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant