Shirabthinath
Shirabthinath

Reputation: 11

Convert JSON to appropriate Format using Ember Serializer

I would like to convert the JSON object

{
 User:{
  'Name':"asdas",
  'Address_Line_1':"dasdasd"
  }
}

to form data

Name=asdas&Address_Line_1=dasdasd

before sending request to my API Server

P.S : I removed root element 'User' using serializeIntoHash method

Upvotes: 0

Views: 75

Answers (1)

siva - abc
siva - abc

Reputation: 181

Try Using

$.param({'Name':"asdas", 'Address_Line_1':"dasdasd"});

Ember DS.Store methods will convert the params to form data format automatically. However you can do it manually using $.params(obj).

$.params(obj) will return object props and values in form data format

Upvotes: 1

Related Questions