-3

My object is like this:

var response = {
    "HotelNo": "1",
    "HCode": "IDGOR_00008",
    "Name": "Amaris Hotel Gorontalo",
    "CheckIn": "2016-05-01",
    "CheckOut": "2016-05-02",
    "Currency": "IDR",
    "TotalRate": "380000",
    "Status": "OR"
}

I want change the object to object array like this:

var response = [{
    "HotelNo": "1",
    "HCode": "IDGOR_00004",
    "Name": "Maqna Hotel",
    "CheckIn": "2016-05-01",
    "CheckOut": "2016-05-02",
    "Currency": "IDR",
    "TotalRate": "582960",
    "Status": "OK"
}];

Any solution to solve my problem?

2
  • And what are trying to achieve? Commented Apr 29, 2016 at 3:57
  • Why do some of the property values change once in the array? At least make your example output consistent with the example input. Commented Apr 29, 2016 at 4:06

1 Answer 1

4

You can wrap the object in array

response = [response];
Sign up to request clarification or add additional context in comments.

1 Comment

I need you help. look here : stackoverflow.com/questions/37209847/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.