You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: demo_jsonlab_basic.m
    path of file: ./repos/jsonlab/examples
    
    the code of the file until where you have to start completion: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%         Demonstration of Basic Utilities of JSONlab
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

rngstate = rand ('state');
randseed = hex2dec('623F9A9E');
clear data2json json2data;

if (exist('isequaln') == 0)
    isequaln = @isequal;
end

fprintf(1, '\n%%=================================================\n');
fprintf(1, '%%  a simple scalar value \n
    
function handle\n');
fprintf(1, '%%=================================================\n\n');

data2json = @(x) x + 1;
savejson('handle', data2json);
json2data = loadjson(ans);

fprintf(1, '\n%%=================================================\n');
fprintf(1, '%%  a 2D cell array\n');
fprintf(1, '%%=================================================\n\n');

data2json = {{1, {2, 3}}, {4, 5}, {6}; {7}, {8, 9}, {10}};
savejson('data2json', data2json);
json2data = loadjson(ans);  % only savejson works for cell arrays, loadjson has issues

fprintf(1, '\n%%=================================================\n');
fprintf(1, '%%  a 2D struct array\n');
fprintf(1, '%%=================================================\n\n');

data2json = repmat(struct('idx', 0, 'data', 'structs'), [2, 3]);
for i = 1:6
    data2json(i).idx = i;
end