是否有任何工具(包括在线服务和macOs应用程序)来美化嵌套的NSDictionary
结果?
{
id = 1;
testName = my name;
createDate = 20021023;
likeNumber = 0;
statusList = ({
appleId = 1;
orangeName = 81;
itsStatus = YES;
});
text = test;
type = Text;
},
我的意思是轻松地折叠(关闭和打开)树节点。
目前,在JSON
Media media = new Media("http://icecast.unitedradio.it/Radio105.mp3");
MediaPlayer mediaPlayer = new MediaPlayer(media);
MediaView mediaView = new MediaView(mediaPlayer);
mediaView.setFitHeight(500);
mediaView.setFitWidth(500);
mediaPlayer.setVolume(new Double(1));
root.getChildren().add(mediaView);
Button playButton = new Button();
playButton.setOnMouseClicked(new EventHandler<javafx.scene.input.MouseEvent>()
{
@Override
public void handle(javafx.scene.input.MouseEvent event)
{
mediaPlayer.play();
}
});
root.getChildren().add(playButton);
primaryStage.setScene(scene);
primaryStage.show();
等 <tbody>
<?php
$day = date('Y-m-d',strtotime('first day of this month'));
for($i= 1; $i < date('t') + 1; $i++){
?>
<tr>
<td><a href='#modal-dialog' class='btn btn-xs btn-success' data-toggle='modal'><span class='fa fa-pencil'></span>i=<?php echo $i; ?></td>
<td><?php echo date('M-d',strtotime($day)); ?></td>
<td><?php echo date('l',strtotime($day)); ?></td>
<?php
for($j =1;$j<=8;$j++){
echo "<td></td>".PHP_EOL;
}
?>
</tr>
<?php
$day = date('Y-m-d', strtotime('+1 day', strtotime($date)));
} ?>
</tbody>
时,有很多用于此目的的在线工具。
答案 0 :(得分:0)
正如Fonix所提到的,将NSDictionary
转换为JSON
然后使用JSON
工具实现此目的的最佳方法是:
+(NSString *)dictionaryToJson:(NSDictionary *)dictionary {
NSError *error;
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dictionary
options:NSJSONWritingPrettyPrinted // Pass 0 if you don't care about the readability of the generated string
error:&error];
NSString *jsonString;
if (! jsonData) {
NSLog(@"Got an error: %@", error);
jsonString = [error localizedDescription];
} else {
jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
}
return jsonString;
}