Remove conditional JSON
This commit is contained in:
parent
8a86413fdd
commit
0194e3a7a0
|
@ -111,9 +111,9 @@ class Radical {
|
||||||
|
|
||||||
Map<String, dynamic> toJson() =>
|
Map<String, dynamic> toJson() =>
|
||||||
{
|
{
|
||||||
if (symbol != null) 'symbol': symbol,
|
'symbol': symbol,
|
||||||
if (forms != null) 'forms': forms,
|
'forms': forms,
|
||||||
if (meaning != null) 'meaning': meaning
|
'meaning': meaning
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -152,7 +152,7 @@ class KanjiResult {
|
||||||
'found': found,
|
'found': found,
|
||||||
'taughtIn': taughtIn,
|
'taughtIn': taughtIn,
|
||||||
'jlptLevel': jlptLevel,
|
'jlptLevel': jlptLevel,
|
||||||
'newspaperFrequencyRank': newspaperFrequencyRank.toString(), // TODO: Rewrite tests to make this value an int
|
'newspaperFrequencyRank': newspaperFrequencyRank,
|
||||||
'strokeCount': strokeCount,
|
'strokeCount': strokeCount,
|
||||||
'meaning': meaning,
|
'meaning': meaning,
|
||||||
'kunyomi': kunyomi,
|
'kunyomi': kunyomi,
|
||||||
|
@ -167,9 +167,6 @@ class KanjiResult {
|
||||||
'uri': uri
|
'uri': uri
|
||||||
};
|
};
|
||||||
|
|
||||||
if (newspaperFrequencyRank == null) returnObject.update('newspaperFrequencyRank', (value) => null);
|
|
||||||
returnObject.removeWhere((key, value) => value == null);
|
|
||||||
|
|
||||||
return returnObject;
|
return returnObject;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -185,8 +182,8 @@ class ExampleSentencePiece {
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
return {
|
return {
|
||||||
if (lifted != null) 'lifted': lifted,
|
'lifted': lifted,
|
||||||
if (unlifted != null)'unlifted': unlifted
|
'unlifted': unlifted
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue