Taking into account the input limit parameter.

This change enables the input limit parameter. If the parameter is omitted or equals to -1, there is no limit on the number of records returned. The parameter is useful for the results of type List (i.e. JSON array) and it allows users to restrict the length of the result to a specific number of records.