NodeJS "identifier starts immediately after numeric literal" when using a variable JSON object on a jade page
<p>I have a NodeJS App which send a json object from MongoDB on the jade page. In the jade page i can use succefully the json object by using the variabele ${data}, except when i am using it in an javascript in the jade page.Then i get the following error:</p>

<pre><code>SyntaxError: identifier starts immediately after numeric literal
_id: 56c75f2730cc57130ea7e1db },{ tagScore: null,
</code></pre>

<p>I read a lot of articles on Stackoverflow. But what i learned from it is that JSON attributes can't handle nummeric values (which is a standaard identifier from mongodb). </p>

<p>But i don't mentioned about a variable json object. Please can you help me to understand and fix this problem.</p>

<p><strong>Example variable JSON Object</strong></p>

<pre><code>{ tagScore: null,
  tagCattegory: '',
  lookupValue: 'Autoschade',
  typeBusinessRule: 'Zoekwaarde',
  _id: 56c75f2730cc57130ea7e1db }
</code></pre>

<p><strong>Routes.js</strong></p>

<pre><code>    req.app.db.models.BusinessRules.pagedFind({
    filters: filters,
    keys: 'lookupValue  tagCattegory  tagScore  typeBusinessRule',
    limit: req.query.limit,
    page: req.query.page,
    sort: req.query.sort
}, function(err, results) {
    if (err) {
        return next(err);
    }

    if (req.xhr) {
        res.header("Cache-Control", "no-cache, no-store, must-revalidate");
        results.filters = req.query;
        console.log("Results XHR ");
        res.send(results);
        res.json(results);
    }
    else {
        results.filters = req.query;
        //res.json(results);
        console.log("Results No XHR ");
        //console.log(results);
        res.render('BusinessRules/index', { data: results.data });


    }

});
</code></pre>

<p><strong>Jade file</strong></p>

<pre><code>            script.
            console.log("Load TestData");
            var businessRulesData =  '{"BusinessRules":[ ' + toString(#{data}) + ']}';
</code></pre>

<p><strong>Mongoose schema &amp; model</strong></p>

<pre><code>exports = module.exports = function(app, mongoose) {
var rulesSchema = new mongoose.Schema({
    lookupValue: { type: String, required:true},
    typeBusinessRule: { type: String},
    tagCattegory: { type: String},
    tagScore:     { type: Number},
    creationDate: { type: Date},
    search: [String]
});
rulesSchema.plugin(require('./plugins/pagedFind'));
rulesSchema.index({ lookupValue: 1 });
rulesSchema.index({ tagCattegory: 1 });
rulesSchema.index({ typeBusinessRule: 1 });
rulesSchema.index({ tagScore: 1 });
rulesSchema.index({ creationDate: 1 });
rulesSchema.index({ search: 1 });
rulesSchema.set('autoIndex', (app.get('env') === 'development'));
app.db.model('BusinessRules', rulesSchema);
};
</code></pre>