- When working with strings, is it possible to get the Key itself with the Value of this JSON string?
Can
In my projects for working with JSON I use the library org.json .
/* Π‘ΠΎΠ·Π΄Π°ΡΠΌ JSON-ΠΎΠ±ΡΠ΅ΠΊΡ ΠΈΠ· ΡΠΊΠ°Π·Π°Π½Π½ΠΎΠΉ ΡΡΡΠΎΠΊΠΈ */ JSONObject jObj = new JSONObject("{\"firstName\":\"***\",\"lastName\":\"***\",\"nickName\":\"***\",\"email\":\"***\",\"password\":\"***\",\"customerType\":\"***\",\"formId\":\"***\"}"); String firstName = jObj.getString("firstName"); // ΠΠ·Π²Π»Π΅ΠΊΠ°Π΅ΠΌ Π·Π½Π°ΡΠ΅Π½ΠΈΠ΅ ΡΠΈΠΏΠ° String ΠΏΠΎ ΡΠΊΠ°Π·Π°Π½Π½ΠΎΠΌΡ ΠΊΠ»ΡΡΡ.
- Is there a method to remove formId from a string?
Same as above:
jObj.remove("formId"); // Π£Π΄Π°Π»ΡΠ΅ΠΌ ΡΠ»Π΅ΠΌΠ΅Π½Ρ ΠΏΠΎ ΡΠΊΠ°Π·Π°Π½Π½ΠΎΠΌΡ ΠΊΠ»ΡΡΡ.
You can also look at other methods for working with JSON in the library repository.