try it i have made few changes in your code

    public class rest_collection
    {
        public IEnumerable<rest_all_data> rest_all_datas { get; set; }
    }

    public void AddRestaurantMultiple([FromBody] JObject rest_all)
    {
        string k = rest_all.ToString();
        JavaScriptSerializer serializer = new JavaScriptSerializer();
        rest_collection collection = serializer.Deserialize<rest_collection>(k);
    }
Answer from tutorialplus.net on Stack Overflow
🌐
University of Alberta
sites.ualberta.ca › ~delliott › ece492 › appnotes › 2015w › G6_Parsing_JSON_in_C › microjson_tutorial.html
Parsing JSON in C using microjson
To handle this, we have to specify that the incoming JSON has an array and that each of the elements in the array have the form of my_object. We'll want to keep this array of my_object within another container structure as follows: /* Data object to model */ struct my_object { char text[SIZE]; bool flag; int count; }; /* List of objects */ struct my_object_list { int nobjects; struct my_object list[MAXOBJECTS]; };
🌐
GitHub
gist.github.com › alan-mushi › 19546a0e2c6bd4e059fd
Examples for the json-c tutorial. · GitHub
sudo apt install libjson-c-dev sudo apt-get install libjson-c-dev · You only needed one of the commands....
🌐
W3Schools
w3schools.com › js › js_json_server.asp
W3Schools.com
The Content-Type header tells the server what type of data is being sent. ... The value application/json tells the server that the request body contains JSON. The request body must contain text, not a JavaScript object.
🌐
Programming in Linux
linuxprograms.wordpress.com › category › json-c
json-c – Programming in Linux
JSON string: {"sitename" : "joys of programming", "categories" : [ "c" , ["c++" , "c" ], "java", "PHP" ], "author-details": { "admin": false, "name" : "Joys of Programming", "Number of Posts" : 10 } } type: type: json_type_string value: joys of programming type: type: json_type_array, Array Length: 4 value[0]: type: json_type_string value: c Array Length: 2 value[0]: type: json_type_string value: c++ value[1]: type: json_type_string value: c value[2]: type: json_type_string value: java value[3]: type: json_type_string value: PHP type: json_type_object type: type: json_type_boolean value: false type: type: json_type_string value: Joys of Programming type: type: json_type_int value: 10
🌐
Stack Overflow
stackoverflow.com › questions › 61118408 › how-to-transform-several-json-objects-using-json-c
How to transform several JSON objects using json-c? - Stack Overflow
I think initializing buffer to 1024 will cause problems if the number of objects is too large, so is there a way to make buffer take the objects one by one? I have a feeling that the deallocation of memory is not right, did I forget some free ? ... json_tokener_parse() returns the first JSON object it finds in the provided buffer.
🌐
Thiago Passos
passos.com.au › converting-json-object-into-c-list
Converting JSON Objects into C# List<> - Thiago Passos
March 7, 2019 - Using JsonProperty is out of the equation because I have no idea what the property name for each individual player is going to be, also at the end of the day I want to bind that property name to the value of an Id field. Another tricky point is the fact that's players is an object and I want it to be an array. I want each individual player inside that players object to be bound to this C...
Find elsewhere
🌐
GitHub
github.com › json-c › json-c
GitHub - json-c/json-c: https://github.com/json-c/json-c is the official code repository for json-c. See the wiki for release tarballs for download. API docs at http://json-c.github.io/json-c/ · GitHub
JSON-C implements a reference counting object model that allows you to easily construct JSON objects in C, output them as JSON formatted strings and parse JSON formatted strings back into the C representation of JSON objects.
Author: json-c
Top answer
1 of 1
1

Thanks @wiseveri for the tip, managed to access the values section with the following:

// gcc json_c_test.c -ljson-c -o json_c_test && clear && ./json_c_test

#include <json/json.h>
#include <stdio.h>

void json_parse_input( json_object *jobj )
{
    int exists, i, j, k, l;
    char *results;
    json_object *queriesObj, *resultsObj, *valuesObj, *tmpQueries, *tmpResults, *tmpValues, *tmpSeparateVals;

    /* Get query key */
    exists = json_object_object_get_ex( jobj, "queries", &queriesObj );
    if ( FALSE == exists )
    {
        printf( "\"queries\" not found in JSON\n" );
        return;
    }

    /* Loop through array of queries */
    for ( i = 0; i < json_object_array_length( queriesObj ); i++ )
    {
        tmpQueries = json_object_array_get_idx( queriesObj, i );

        /* Get results info */
        exists = json_object_object_get_ex( tmpQueries, "results", &resultsObj );
        if ( FALSE == exists )
        {
            printf( "\"results\" not found in JSON\n" );
            return;
        }

        /* Loop through array of results */
        for ( j = 0; j < json_object_array_length( resultsObj ); j++ )
        {
            tmpResults = json_object_array_get_idx ( resultsObj, j );

            /* Get values */
            exists = json_object_object_get_ex( tmpResults, "values", &valuesObj );
            if ( FALSE == exists )
            {
                printf( "\"values\" not found in JSON\n" );
                return;
            }

            /* Loop through array of array of values */
            for ( k = 0; k < json_object_array_length( valuesObj ); k++ )
            {
                tmpValues = json_object_array_get_idx ( valuesObj, k );

                /* Loop through array of values */
                for ( l = 0; l < json_object_array_length( tmpValues ); l++ )
                {
                    tmpSeparateVals = json_object_array_get_idx ( tmpValues, l );
                    printf( "Values:[%d] = %s \n", l, json_object_to_json_string( tmpSeparateVals ) );
                }
            }
        }
    }
}

int main()
{
    json_object *jobj;

    char * string = " { \"queries\" : [ { \"sample_size\" : 1, \"results\" : [ { \"name\" : \"data\", \"group_by\" : [{ \"name\" : \"type\", \"type\" : \"number\" }], \"tags\" : { \"hostname\" : [ \"host\" ]}, \"values\": [[1438775895302, 143]] } ], } ] } ";
    printf ( "JSON string: %s\n\n", string );

    jobj = json_tokener_parse( string );
    json_parse_input( jobj );
}
🌐
W3Resource
w3resource.com › JSON › structures.php
JSON Structures | JSON tutorial | w3resource
JSON supports two widely used (amongst programming languages) data structures. A collection of name/value pairs. Different programming languages support this data structure in different names. Like object, record, struct, dictionary, hash table, keyed list, or associative array.
🌐
C# Corner
c-sharpcorner.com › UploadFile › vendettamit › parsing-list-of-json-elements-as-list-with-json-net
Parsing List of JSON Elements as List With JSON.Net
November 11, 2020 - And so you will get a complete list of correct items and corrupted data. We'll use a JArray class from the namespace Newtonsoft.Json.Linq to parse the data as a list of arrays of objects and then we'll convert one by one each item to a typed object and add it to the list.
🌐
Json-c
json-c.github.io › json-c › json-c-0.10 › doc › html › json__object_8h.html
json-c: json_object.h File Reference
To ensure the full range is maintained, use json_object_new_int64 instead. ... Create a new empty object with a reference count of 1. The caller of this object initially has sole ownership. Remember, when using json_object_object_add or json_object_array_put_idx, ownership will transfer to the object/array.
🌐
CodeSignal
codesignal.com › learn › courses › parsing-json-with-csharp › lessons › parsing-json-arrays-and-nested-structures
Parsing JSON Arrays and Nested Structures
A JSON array is a collection of ordered items enclosed in square brackets, [ ]. Each item in an array could be an object, a string, a number, or even another array. JSON arrays are used to store lists or sequences.
🌐
Json-c
json-c.github.io › json-c › json-c-current-release › doc › html › files.html
json-c: File List
Here is a list of all files with brief descriptions: [detail level 12] Generated on Sat Jun 27 2026 09:45:25 for json-c by 1.9.8
🌐
Webdevtutor
webdevtutor.net › blog › c-sharp-json-list-of-objects
Working with JSON List of Objects in C#
By understanding how to serialize and deserialize lists of objects, you can efficiently manage and manipulate JSON data in your C# applications.
Top answer
1 of 7
3

Lean towards option 1, as it's a more expected format.

Option 1 works with JSON as it's designed to be used and therefore benefits from what JSON offers (a degree of human readability, which is good for debugging, and straightforward parsing, which is good for limiting entire categories of bugs to begin with).

Option 2 begrudgingly adopts JSON and subverts many of the benefits. If you don't want human readability, use protobuf or something similar... AIWalker's "CSV"-like approach isn't terrible either. It is marginally better (readable) than splitting objects apart and recombining them. But, this is still not as good (readable) as using JSON "as designed".

Also bear in mind, your API responses are also likely going to be gzipped. Most of the repetition in option 1 will be quickly and transparently condensed over the wire.

As an aside, if you're moving a lot of data, also consider JSONL or paginated results. Pagination can be especially helpful for web clients, as it places natural pauses in the processing, providing a degree of "organic" protection against UI lockups.

2 of 7
3

A list of objects is easier to work with. You can use append, map, filter... All the nice things JS Arrays have which manual indexing doesn't. And there's no way to get out of sync, so that's an entire class of bugs gone.

If you're worried about efficiency:

  • Measure (premature optimization is the root of all evil)
  • Consider the list of lists trick AIWalker proposed
  • Consider an outright binary format
  • Make sure gzip is enabled
  • Measure (it's worth saying twice)