Hello.
I have a catalog table.
I want to list all records with JSON format.
Is there a short way to do this?
I'm doing it like this.
Query = New Query;
Query.Text =
".... .. . . . . . . . .. . ";
QueryResult = Query.Execute();
SelectionDetailRecords = QueryResult.Select();
newarray= New Array;
While SelectionDetailRecords.Next() Do
arraystrc= New Structure;
arraystrc.Insert("KEY",SelectionDetailRecords["FIELD"]);
..
..
..
newarray.Add(arraystrc);
EndDo;
JSONWriter = New JSONWriter;
JSONWriterSettings =JSONWriter = New JSONWriter;
JSONWriter.SetString();
WriteJSON(JSONWriter, newarray);
Result = JSONWriter.Close();
Response = New HTTPServiceResponse(?(True, 200, 404));
Response.SetBodyFromString(Result, TextEncoding.System);
Return Response;
The 1C:Enterprise developers forum