Skip to content

Commit

Permalink
SNOW-811103: Set new Function as default json parser (#635)
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-dprzybysz authored Sep 19, 2023
1 parent db8b189 commit 3cd1da7
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions lib/global_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,8 @@ const mkdirp = require('mkdirp');
const Util = require('./util');
const Errors = require('./errors');
const Logger = require('./logger');
const vm = require('vm');
const { XMLParser, XMLValidator } = require("fast-xml-parser");

const VM_CONTEXT = vm.createContext() // create a new context so VM does not have to make a new one for each conversion

let insecureConnect = false;

/**
Expand Down Expand Up @@ -173,7 +170,7 @@ const rest = {
exports.rest = rest;

// The default JSON parser
exports.jsonColumnVariantParser = rawColumnValue => vm.runInContext("(" + rawColumnValue + ")", VM_CONTEXT);
exports.jsonColumnVariantParser = rawColumnValue => new Function(`return (${rawColumnValue});`)();

/**
* Updates the value of the 'jsonColumnVariantParser' parameter.
Expand Down

0 comments on commit 3cd1da7

Please sign in to comment.