{"firstName":"***","lastName":"***","nickName":"***","email":"***","password":"***","customerType":"***","formId":"***"} 
  1. When working with strings, is it possible to get the Key itself with the Value of this JSON string?
  2. Is there a method to remove formId from a string?

    1 answer 1

    1. 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 ΠΏΠΎ ΡƒΠΊΠ°Π·Π°Π½Π½ΠΎΠΌΡƒ ΠΊΠ»ΡŽΡ‡Ρƒ. 
    1. 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.