0

I am creating an object from JSON that has a String[] property, so the JSON looks like this:

{
key1: "val1", 
key2: ["val2a", "val2b", "val2c"],
}

What's the best way to define this as a JavaScriptObject?

Right now I am defining a new object JSString, so the java object looks like this:

public class MyObject extends JavaScriptObject {
   ...
   public JSArray<JSString> getKey2() {...    
}

This is kinda annoying. It'd be nice if I could do this:

public class MyObject extends JavaScriptObject {
   ...
   public String[] getKey2() {...    
}

But that doesn't work. Is there a better way? Thanks in advance

1 Answer 1

2

Did you look at JsArrayString?

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.