-
Notifications
You must be signed in to change notification settings - Fork 334
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New option to the JSON function to serialize unwrapped arrays (#2231)
Common request: ability of the JSON function to serialize [1,2,3] as `[1,2,3]` instead of `[{"Value":1},{"Value":2},{"Value":3}]`
- Loading branch information
1 parent
d552c10
commit d8d3e8c
Showing
11 changed files
with
117 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
src/tests/Microsoft.PowerFx.Core.Tests/ExpressionTestCases/JSON_OptionSets.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// (UTC-08:00) Pacific Time (US & Canada) | ||
#SETUP: OptionSetTestSetup | ||
#SETUP: EnableJsonFunctions | ||
|
||
>> JSON(OptionSet.Option2) | ||
"""option_2""" |
11 changes: 11 additions & 0 deletions
11
src/tests/Microsoft.PowerFx.Core.Tests/ExpressionTestCases/JSON_US.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// (UTC-08:00) Pacific Time (US & Canada) | ||
#SETUP: TimeZoneInfo("Pacific Standard Time") | ||
#SETUP: EnableJsonFunctions | ||
|
||
// Midnight local time in Pacific Time is 8 AM UTC | ||
>> JSON(DateTimeValue("1970-01-01T00:00:00")) | ||
"""1970-01-01T08:00:00.000Z""" | ||
|
||
// DateTime is local time, so 1AM in UTC | ||
>> JSON(Table({a:DateTime(2014,11,29,17,5,1,997),b:Date(2019, 4, 22),c:Time(12, 34, 56, 789)})) | ||
"[{""a"":""2014-11-30T01:05:01.997Z"",""b"":""2019-04-22"",""c"":""12:34:56.789""}]" |
5 changes: 5 additions & 0 deletions
5
src/tests/Microsoft.PowerFx.Core.Tests/ExpressionTestCases/JSON_V1Compat.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#SETUP: PowerFxV1CompatibilityRules | ||
|
||
// Error for unknown options in the second argument | ||
>> JSON({a:1,b:[1,2,3]}, "_U") | ||
Errors: Error 22-26: The value 'U' is not supported as an option in the JSON function. |
5 changes: 5 additions & 0 deletions
5
src/tests/Microsoft.PowerFx.Core.Tests/ExpressionTestCases/JSON_V1CompatDisabled.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#SETUP: disable:PowerFxV1CompatibilityRules | ||
|
||
// Ignore unknown options in the second argument | ||
>> JSON({a:1,b:[1,2,3]}, "_U") | ||
"{""a"":1,""b"":[1,2,3]}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters