Skip to content

Commit

Permalink
Merge branch 'release/0.15.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
devlead committed Oct 21, 2019
2 parents f358392 + a90b59e commit a9b3430
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ osx_image: xcode9.2
mono:
- 4.4.2

dotnet: 2.1.3
dotnet: 3.0.100

before_install:
- git fetch --unshallow # Travis always does a shallow clone, but GitVersion needs the full history including branches and tags
- git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
- git fetch origin
- git fetch origin

script:
- ./build.sh --target=Test
4 changes: 2 additions & 2 deletions build.config
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env bash
CAKE_VERSION=0.34.1
DOTNET_VERSION=3.0.100-rc1-014190
CAKE_VERSION=0.35.0
DOTNET_VERSION=3.0.100
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"src"
],
"sdk": {
"version": "3.0.100-rc1-014190"
"version": "3.0.100"
}
}
9 changes: 6 additions & 3 deletions src/LitJson/JsonMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -779,10 +779,13 @@ private static void RegisterBaseImporters ()
return;
}

if (obj is IDictionary) {
if (obj is IDictionary dictionary) {
writer.WriteObjectStart ();
foreach (DictionaryEntry entry in (IDictionary) obj) {
writer.WritePropertyName ((string) entry.Key);
foreach (DictionaryEntry entry in dictionary) {
var propertyName = entry.Key is string key ?
key
: Convert.ToString(entry.Key, CultureInfo.InvariantCulture);
writer.WritePropertyName (propertyName);
WriteValue (entry.Value, writer, writer_is_private,
depth + 1);
}
Expand Down
16 changes: 16 additions & 0 deletions test/JsonMapperTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,22 @@ public void ExportEnumsTest ()
Assert.AreEqual ("{\"FavouritePlanet\":1,\"Band\":9}", json);
}

[Test]
public void ExportEnumDictionaryTest()
{
Dictionary<Planets, int> planets = new Dictionary<Planets, int>();

planets.Add(Planets.Jupiter, 5);
planets.Add(Planets.Saturn, 6);
planets.Add(Planets.Uranus, 7);
planets.Add(Planets.Neptune, 8);
planets.Add(Planets.Pluto, 9);

string json = JsonMapper.ToJson(planets);

Assert.AreEqual("{\"Jupiter\":5,\"Saturn\":6,\"Uranus\":7,\"Neptune\":8,\"Pluto\":9}", json);
}

[Test]
public void ExportObjectTest ()
{
Expand Down

0 comments on commit a9b3430

Please sign in to comment.