Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move JSON format bug fixes to new JSON2 format so existing clients will not fail. #6066

Merged
merged 2 commits into from Aug 25, 2014

Conversation

diosmosis
Copy link
Member

Adds deprecation note for JSON format and uses JSON2 in future proof code (angularjs/log importer).

Other JavaScript will automatically use this format when switched to angularjs.

…ll not fail. Add deprecation note for JSON format and use JSON2 in future proof code (angularjs/log importer).
@mattab
Copy link
Member

mattab commented Aug 25, 2014

looks good to me (assuming build passes) 👍

diosmosis pushed a commit that referenced this pull request Aug 25, 2014
Move JSON format bug fixes to new JSON2 format so existing clients will not fail. Adds deprecation note for JSON format and uses JSON2 in future proof code (angularjs/log importer).
@diosmosis diosmosis merged commit 484ff27 into master Aug 25, 2014
@diosmosis diosmosis deleted the json2_api_format branch August 25, 2014 22:36
@mattab mattab mentioned this pull request Aug 26, 2014
@mattab
Copy link
Member

mattab commented Aug 26, 2014

@diosmosis maybe we could link the API Export links (in datatable footers, and in the API listing page) to use json2 format?

@NekR
Copy link

NekR commented Aug 31, 2014

What is JSON2 format? Why you use custom JSON2 object in browser instead of builtin window.JSON?

@diosmosis
Copy link
Member Author

There is no custom JSON2 object in the browser. See https://github.com/piwik/piwik/blob/master/CHANGELOG.md section "2.6.0 - deprecations" for information about this change and read developer.piwik.org for more information on Piwik development.

@NekR
Copy link

NekR commented Aug 31, 2014

What is JSON2 format? What this means for JavaScript client? In deprication notes you say about php.
json2.js by Douglas Crockford is JavaScript realization of builtin ECMAScript global 'JSON' object. It's available since IE8.
json2.js does not add new standard with major version 2. That is just a name of file. There are only one JSON format at all and esspecially for JS front-end. It's always better and save to use builtin browser JSON realization, instead of JS version which uses 'eval()'. In you JavaScript client you always use JavaScript realization and ignore builtin version.

For example, this condition always 'll be true because not one browser has JSON2 global object, but has JSON.

if (typeof JSON2 !== 'object') {
    JSON2 = {};
}

@diosmosis
Copy link
Member Author

There is no JSON2 JS object used by Piwik, this change does not affect the tracker and the json2 library is not used by Piwik. The format is for API responses and has to do with the format query parameter sent in HTTP requests to Piwik.

@diosmosis
Copy link
Member Author

*HTTP requests sent to Piwiks reporting API.

@NekR NekR mentioned this pull request Aug 31, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants