जटिल JSON प्रोसेसिंग

Java में डेटा इम्पोर्ट करना

Anthony Markham

VP Quant Developer

जटिल JSON डेटा

  • नेस्टेड ऑब्जेक्ट्स और एरेज़
  • मिश्रित डेटा टाइप्स
  • APIs और कॉन्फ़िगरेशन फाइलें संभालना 🧠

$$

जटिल json डेटा

Java में डेटा इम्पोर्ट करना

नेस्टेड JSON ऑब्जेक्ट्स

  • नेस्टिंग - ऑब्जेक्ट्स के अंदर ऑब्जेक्ट्स
  • Tablesaw साधारण केस अपने-आप फ्लैटन कर सकता है
  • फ्लैटनिंग - जिस कॉलम में हर पंक्ति में लिस्ट या एरे हो, उसे कई पंक्तियों में बदलना
{
  "customer": {
    "name": "John Doe",
    "address": {
      "street": "123 Main St",                            <- Nested information
      "city": "Boston",                                   <- Nested information
      "coordinates": {"lat": 42.3601, "lng": -71.0589}    <- Nested within nested information
    }
  }
}
Java में डेटा इम्पोर्ट करना

JSON फ्लैटनिंग

customer.name customer.address.street customer.address.city
John Doe 123 Main St Boston

$ $

customer.address.coordinates.lat customer.address.coordinates.lng
42.3601 -71.0589
Java में डेटा इम्पोर्ट करना

JsonReader कॉन्फ़िगरेशन

  • JsonReadOptions से आप कर सकते हैं:
    • सोर्स स्पेसिफिकेशन (फाइल, URL, या स्ट्रिंग)
    • टेबल नाम कॉन्फ़िगरेशन
    • मिसिंग वैल्यू हैंडलिंग
JsonReadOptions options = JsonReadOptions

.builder("complex.json")
.tableName("Products")
.missingValueIndicator("N/A")
.build();
Table data = new JsonReader().read(options);
missingValues = data.stringColumn("name").isMissing();
Java में डेटा इम्पोर्ट करना

टेबल्स को जॉइन करना

  • टेबल्स को जोड़ने के लिए joinOn का उपयोग करें
  • Inner join केवल वही पंक्तियाँ रखता है जो दोनों टेबल्स में हों
Table phones = Table.read().csv("phones.csv");   // name, phone

Table diets = Table.read().csv("diets.csv"); // name, diet
// Perform the inner join on the two tables Table joined = phones.joinOn("name").inner(diets);

$$

$$

  • कई और प्रकार के joins उपलब्ध हैं
Java में डेटा इम्पोर्ट करना

अभ्यास करते हैं!

Java में डेटा इम्पोर्ट करना

Preparing Video For Download...