1

I'm receiving an ajax call with the next data:

[['Berlin'],['Berlin Wannsee'],['Berlin Hauptbahnhof']]

I know that, to be rendered with the autocomplete function of jquery it has to be in the correct json format, but this is what I have. There are any way to could use this directly?

I read something about _renderItem, but I don't know if this is what I need.

1 Answer 1

1

I am afraid you will need to tranform it to a json compatible format.

Get rid of the first and last bracket Split the chain by the comma character Remove the apostrophees and brackets in the resulting array and you will have a clean array with the values you need. At this point you can loop through the array transforming to json manually or use a parser that will format it in a more automatic way.

Sign up to request clarification or add additional context in comments.

Comments

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.