Skip to content

Commit 19b5e6b

Browse files
authored
Merge pull request #258 from mixpanel/jg-stringify
[SR] Use JSON.stringify instead of jsonencode
2 parents 2c93f5c + 28109f1 commit 19b5e6b

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/mixpanel-core.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint camelcase: "off" */
22
import Config from './config';
3-
import { MAX_RECORDING_MS, _, console, userAgent, document, navigator, slice, NOOP_FUNC } from './utils';
3+
import { MAX_RECORDING_MS, _, console, userAgent, document, navigator, slice, NOOP_FUNC, JSONStringify } from './utils';
44
import { isRecordingExpired } from './recorder/utils';
55
import { window } from './window';
66
import { Autocapture } from './autocapture';
@@ -932,7 +932,7 @@ MixpanelLib.prototype.disable = function(events) {
932932
};
933933

934934
MixpanelLib.prototype._encode_data_for_request = function(data) {
935-
var encoded_data = _.JSONEncode(data);
935+
var encoded_data = JSONStringify(data);
936936
if (this.get_config('api_payload_format') === PAYLOAD_TYPE_BASE64) {
937937
encoded_data = _.base64Encode(encoded_data);
938938
}

src/mixpanel-persistence.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
REMOVE_ACTION,
1010
UNION_ACTION
1111
} from './api-actions';
12-
import { _, console } from './utils';
12+
import { _, console, JSONStringify } from './utils';
1313

1414
/*
1515
* Constants
@@ -125,7 +125,7 @@ MixpanelPersistence.prototype.save = function() {
125125

126126
this.storage.set(
127127
this.name,
128-
_.JSONEncode(this['props']),
128+
JSONStringify(this['props']),
129129
this.expire_days,
130130
this.cross_subdomain,
131131
this.secure,

src/recorder/session-recording.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ SessionRecording.prototype._flushEvents = addOptOutCheckMixpanelLib(function (da
416416
'replay_start_url': this.replayStartUrl,
417417
'seq': this.seqNo
418418
};
419-
var eventsJson = _.JSONEncode(data);
419+
var eventsJson = JSON.stringify(data);
420420

421421
// send ID management props if they exist
422422
var deviceId = this._mixpanel.get_property('$device_id');

0 commit comments

Comments
 (0)