9 Replies Latest reply on Jan 11, 2017 9:07 AM by dddan

    maximum size json file?

    dddan

      Hi

      We have a FM server 14, (Mac OS - El Capitan) outputting a json file to a website on request. This worked fine but today we got the message:

      "XML error: No memory at line 1"

      The number of items and fields with data in the json file increased over time, and it seems that the json file FM  server creates is becomes too big, because when we did a small test by modifying the request for the json file to only a selection of items it worked fine again.

       

      Does anybody know if there is indeed a maximum size, if there is way to increase this, or if this behaviour has changed in FMS15?

      Or if this error points to something else?

       

      Note: we usually ask for a list of only the items with a later modification date so that the list is not too big, but every once in a while the web developer prefers to get a complete list, and that's where it goes wrong.

      A possible solution is to split the file in two or three, but if there is way to increase the max size I'd prefer that.

       

      Any help is appreciated,

       

      Thanks, Daniel

        • 1. Re: maximum size json file?
          Johan Hedman

          If you create your JSON in a field you have a maximum of letter you can have in a field

          • 2. Re: maximum size json file?
            dddan

            Hi Johan

            Thanks for the reply. No, it is not generated in a field, it is  a php script that generates the json file directly, see script below. But you might be right that the same restrictions apply. Would you know the maximum characters in a text field in FM? I googled it, but no luck. Meanwhile I' am checking with the web developer how big the file was when it was still working...

            Thanks.

             

            header('Cache-Control: no-cache, must-revalidate');

            header('Content-type: application/json');

            set_time_limit(0);

            error_reporting(0);

            require 'FileMaker.php';

            function errorCheck() {

             

            }

             

            $fm = new FileMaker();

            $fm->setProperty('database’,’SHOP’);

            $fm->setProperty('hostspec','http://111.111.111.111');

            $fm->setProperty('username’,’XXX’);

            $fm->setproperty('password’,’XXX’);

             

            $all = $fm->newFindCommand('ItemsList WEB');

            $all->addFindCriterion('WebPublishCB', '1');

            $result = $all->execute();

             

            if(FileMaker::isError($result)) {

             

              $error = $result->getMessage();

             

              echo $error;

             

              die;

             

            } else {

             

              $records = $result->getRecords();

             

              //echo 'result size' . count($records);

             

              $output=array();

             

              foreach($records as $record) {

             

              $product = array();

             

              foreach($record->getFields() as $field) {

             

              $product[$field] = $record->getField($field);

             

              }

             

              $output[] = $product;

             

              }

             

            }

             

            echo json_encode($output);

            • 3. Re: maximum size json file?
              Johan Hedman

              Here you have the specifications for FM15

              Technical Specifications for FileMaker Pro 15 | FileMaker

              • 5. Re: maximum size json file?
                dddan

                Cool, thanks a lot. I checked the manual, but you (both) pointed me to the right place ;-)

                For both FM13 and FM15 it is for Text: < 10,000,000, I am checking with the web designer if the latest json file that worked is close to that number.

                He is requesting 4200 records, so that would mean more than 2380 characters per record. That could be the issue, including a description and feature list 2380 characters is not that much.

                So it seems that splitting the json file is the answer.

                Thanks a lot for your help!

                • 6. Re: maximum size json file?
                  dddan

                  I am discussing splitting the json file in smaller steps now. The web developer asks me: "Is there any way you can add pagination to the feed so I can send the start and end (like in sql, the limit). That way I can loop on 1000 records until I get them all"

                  I am not a PHP coder, so I am not totally sure what is possible. Using omit multiple is an option but a lot of hassle. As far as I can see there is no simple way yo say in PHP stop in record 1000, create JSON file, and continue with record 1001 and repeat until you reach the foundcount.

                   

                  Other option would be, (as indirectly suggested by Johan) to first compile the data of the 1st 1000 records for him in a single text field, and let him grab the single text field. (Is there a way to force the output to json format when you're compiling data from records into one text field?)

                   

                  But I am totally open for any suggestion to do this more efficient.

                  • 7. Re: maximum size json file?
                    jbante

                    JSON is a very verbose format (but still better than XML!). You could cut down on the characters needed to represent the same data by using CSV instead.

                    • 8. Re: maximum size json file?
                      jbante

                      Would it be useful to pull a text file from a container field instead of the contents of a text field? Container fields can hold more data.

                      • 9. Re: maximum size json file?
                        dddan

                        Thanks, I'll definitely discuss that with the web designer. He first expressed his preference for json, but this might change his viewpoint.