Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. JSONObject obj1=null,obj2=null;
  2.  
  3. obj1=new JSONObject(actual);
  4. obj2=new JSONObject(required);
  5. Iterator<?> keys = obj2.keys();
  6. while( keys.hasNext() ) {
  7. String key = (String)keys.next();
  8. if(obj2.get(key) instanceof JSONArray)
  9. {
  10. if(!compareJSONArray(obj2.getString(key),obj1.getString(key)))
  11. {return false;}
  12. status=true;
  13. }else if(obj2.get(key) instanceof JSONObject)
  14. {
  15. if(!compareJSON(obj2.getString(key),obj1.getString(key)))
  16. {return false;}
  17. status=true;
  18. }else{
  19. if(obj2.getString(key).equalsIgnoreCase(obj1.getString(key)))
  20. {
  21.  
  22. status=true;
  23. }
  24. else{
  25. return false;
  26. }
  27.  
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement