Gson returns Json object with `=` instead of `:`

Here is my code:

assertEquals(
    gson.fromJson("[{\"vehicle_side\":\"driver\",\"vehicle_occupant_role\":\"driver\",\"vehicle_window\":\"front_right\",\"window_status\":10.0}]", List.class),           
    gson.fromJson(myJsonObject, List.class)
);

The assertion fails because:

Expected :[{vehicle_window=front_right, vehicle_occupant_role=driver, window_status=10.0, vehicle_side=driver}]
Actual   :[{"vehicle_side":"driver","vehicle_occupant_role":"driver","vehicle_window":"front_right","window_status":10.0}]

Why does my expected object contain = instead of :? I even tried it with the actual json string hardcoded, but I get the same result:



Read more here: https://stackoverflow.com/questions/68475782/gson-returns-json-object-with-instead-of

Content Attribution

This content was originally published by ritratt at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: