JSON:
{
"hashrate": 551125275,
"miners": {
"0x0916c53bc9c5a934f9b3dc1b01abd56241569977": {
"lastBeat": 1538180874,
"hr": 139778683,
"offline": false
},
"0x3382e1265913d1f8161ead5422b7ca1e7cd80fc6": {
"lastBeat": 1538180856,
"hr": 22072348,
"offline": false
}
},
"minersTotal": 2,
"now": 1538180878485
}
我想要这样: 帐户1:0x0916c53bc9c5a934f9b3dc1b01abd56241569977 帐户2:0x3382e1265913d1f8161ead5422b7ca1e7cd80fc6
答案 0 :(得分:0)
在PHP中使用JSON的最简单方法是使用JSON扩展名。参见http://php.net/manual/en/book.json.php
因此您可以将JSON字符串转换为 stdClass ,反之亦然。
赞:
Sub find_highlight1() 'Unhide and go to the 1st sheet found the data
Dim FindString As String
Dim wrkSht As Worksheet
Dim FoundCell As Range
Dim FirstAddress As String
Dim countfound As Integer
Dim sheetactive As Integer
countfound = 0
sheetactive = 0
FindString = InputBox("Please Key in the Number You Wish to Search")
If FindString = "" Then Exit Sub
'Use For...Each to cycle through the Worksheets collection.
For Each wrkSht In ThisWorkbook.Worksheets
'Find the first instance on the sheet.
Set FoundCell = wrkSht.Cells.Find(What:=FindString, After:=wrkSht.Range("A1"), LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False)
'Check it found something.
If Not FoundCell Is Nothing Then
'Save the first address as FIND loops around to the start
FirstAddress = FoundCell.Address
wrkSht.Visible = xlSheetVisible 'Unhide worksheet where found
countfound = countfound + 1
sheetactive = sheetactive + 1
If sheetactive <= 1 Then
wrkSht.Select
End If
Do
With FoundCell.Interior
.ColorIndex = 6
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
'Look for the next instance on the same sheet.
Set FoundCell = wrkSht.Cells.FindNext(FoundCell)
Loop While FoundCell.Address <> FirstAddress
End If
Next wrkSht
End Sub`
答案 1 :(得分:0)
$json = ' {
"hashrate": 551125275,
"miners": {
"0x0916c53bc9c5a934f9b3dc1b01abd56241569977": {
"lastBeat": 1538180874,
"hr": 139778683,
"offline": false
},
"0x3382e1265913d1f8161ead5422b7ca1e7cd80fc6": {
"lastBeat": 1538180856,
"hr": 22072348,
"offline": false
}
},
"minersTotal": 2,
"now": 1538180878485
}';
$data = json_decode($json);
$i = 1;
foreach ($data->miners as $key => $value) {
echo 'Account' . $i++ . ':' . $key . PHP_EOL;
}