TJSONArray* jar = (TJSONArray*)TJSONObject::ParseJSONValue(Memo3->Text); jar->Count; for (int i = 0; i < jar->Size(); i++) { TJSONValue *jv = jar->Get(i); jv = ((TJSONArray*)jv)->Get(1); TJSONPair *jp = (TJSONPair*)jv; jp->JsonString->Value();//值字段名 jp->JsonValue->Value();//取值 if (jp->JsonValue->Value() == "1") // 判断值 { jar->Remove(i); break; } } // jar->Remove(1); Memo3->Text = jar->ToString(); delete jar;
TJSONObject *JSON = (TJSONObject*)TJSONObject::ParseJSONValue(Memo2->Text);
TJSONArray* jArray = (TJSONArray*)JSON->Get("adverts")->JsonValue;
TJSONObject* jCompanyInfo = (TJSONObject*)((TJSONObject*)jArray->Get(0))->Get("companyInfo")->JsonValue;
String companyName = jCompanyInfo->Get("companyName")->JsonValue->Value();
时间: 2024-10-13 10:20:17