Can i create object to object map inside Google firestore console?

I have following object:

public class Cart {
    public String id;
    public List<Map<Product, Double>> productsInCart;
}

In this key itself is a complex object, how to do it in firestore? Also above object can be redesigned as following

public class Cart {
    public String id;
    public Map<Product, Double> productsInCart;
}

Answer

Firestore does not have any sense of “complex” keys or properties. Fields and nested object property names must be strings. If you need to store something more complex, you will need to somehow reduce it down to a unique string. One option is to use a hash of the data in the object, but you’re better off redesigning your object to simply use strings as keys.