0

so, I have to use firebase remote config in a project for some clients, and I am using a key to store a value and the value is not like a String, etc... but rather an array. let's say that the value looks like this:

 
 [
      {
        "owner": "jon",
        "year": 2019
      },
      {
        "owner": "Alex",
        "versionCode": 2032
      },
      ...
 ]

how am I supposed to get the owner and year and save them in a list of Laptops with gson?

Laptops.java look like this btw:

public class Laptop() {
    private String owner;
    private int year;

    // constructor
    ...
    // getters and setters
    ...
}

The answer from this post: Can I declare an array to Firebase Remote config? kinda helped but the answer is in kotlin, and I think the syntax is not exactly the same in java Thanks in advance!

Anonymous
  • 223
  • 3
  • 9
  • See this https://stackoverflow.com/questions/5314813/json-gson-fromjson-java-objects replace "this.json" with your json string – Elvis Feb 02 '21 at 18:44
  • @Elvis Hi, sorry for the late reply; it's just that I can't figure out what "this" is in that case? in the comments he says that "it's input json string" ? I don't really know what that means and I think the syntax for that may have changed since 2011? – Anonymous Feb 04 '21 at 12:44

0 Answers0