Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.xyz.model;
- import org.codehaus.jackson.annotate.JsonIgnoreProperties;
- import org.codehaus.jackson.map.annotate.JsonSerialize;
- @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
- @JsonIgnoreProperties(ignoreUnknown = true)
- public class Register {
- private String Name;
- private String Email;
- private String Password;
- public String getName() {
- return Name;
- }
- public void setName(String Name) {
- this.Name = Name;
- }
- //other getter and setter
- public Register()
- {}
- }
- public String Register(Register reg) {
- String url = URL + "/users";
- String name = reg.getName();
- String email = reg.getEmail();
- String password = reg.getPassword();
- JSONObject jsondata = new JSONObject();
- jsondata.put("Name", name);
- jsondata.put("Email", email);
- jsondata.put("Password", password);
- HttpEntity<?> requestEntity = new Connection().getConnection(jsondata
- .toString());
- //......code for connection to url..
- } catch (Exception e) {
- System.out.println("failed"+e.getMessage());
- }
- failed Could not read JSON: Can not instantiate value of type [simple type, class com.xyz.model.Register] from JSON integral number; no single-int-arg constructor/factory method; nested exception is org.codehaus.jackson.map.JsonMappingException: Can not instantiate value of type [simple type, class com.xyz.model.Register] from JSON integral number; no single-int-arg constructor/factory method.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement