0

I'm trying to create a json with multiple records by following this example: Generate a sample JSON with an array in it in Delphi XE5 must be the same way, except that when I add the array to the object

JSonObj.AddPair (TJSONPair.Create ('records', TJSONArray));

returns the error:

"There is the overloaded version of 'Create' that can be called with arguments These"

How do I add to the array object? If I convert an array to string and add, to receive the amounts can not treat as an array ...

1 Answer 1

3

You're passing it the class reference for a JSON array. You need to pass it an instance.

arr := TJSONArray.Create;
JSONObj.AddPair(TJSONPair.Create('records', arr));

Look carefully at the answers in the question you link to, and you'll see this is exactly what they're doing, too.

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.