Question: I am having user id's and equivalent mail ids in file. according to user input ( i.e, we will give input as "apple") it should grep only mail id (only apple@gmail.com) and stored in email=$(...)

in-between user ids & mail ids have one space gap in file 

*mail id's in file*

```
user_id's   mail_id's

apple apple@gmail.com
mango 123@ymail.com
cat cat@hotmail.com
etc...

```

*sample*

```
email=$(....)

msg= dont run jobs in login node

echo -e "$msg" |mail -s "RAM limit exceeded in iitmlogin4" "$email"

```

Answer: 
Serialization (POJO -> JSON) and deserialization (JSON -> POJO) in Spring is simply obtained via `@RequestBody` and `@ResponseBody` annotations.

You just need to define a Java class that represents/maps your JSON object on server-side.

Example:

### Input JSON

```
{id: 123, name: "your name", description: ""}

```

### Java class

```
public class MyClass {
    private int id;
    private String name;
    private String description;
}

```

### Methods in your controller

```
public void postJson(@RequestBody MyClass o){
    // do something...
}

public @ResponseBody MyClass getJson(){
    // do something...
}

```

**NOTE** I omitted `@RequestMapping` settings.
You will have to provide csrf token for POST request. Instead you can try this. 

[sending HashMap by angularjs $http.get in spring mvc](https://stackoverflow.com/questions/29060493/sending-hashmap-by-angularjs-http-get-in-spring-mvc)

It works fine just a bit extra @RequestParams but on the better side you can send additional information too and not only the respective object.