Turn off HTML escaping

Report a typo

Your JSON data is going to be directly rendered on a website, so you've been tasked with making sure that any HTML in the JSON property or value does not get automatically escaped when serializing or deserializing. Suppose you used the following code to make sure the property name is bolded and that any HTML in the current object's fields stays as HTML.

MeleeWeaponGsonObject.addProperty("<strong>Warriors Who Wield<strong>", meleeWeapon.getWarriorsWhoWield());

Write the method call that must be added to the GsonBuilder method chain to ensure this behavior.

Gson gson = new GsonBuilder()
    // add method here
    .create();
Enter a short text
___

Create a free account to access the full topic